我已经成功地使用MinGW64(MSYS2)编译了POCO库。要构建它,我安装了Windows SDK,并将mc.exe
的路径添加到PATH环境中,因此我执行了:
pacman -S mingw-w64-x86_64-cmake
# Get POCO
git clone -b master https://github.com/pocoproject/poco.git
# set Windows SDK to the PATH
export PATH="/c/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64:$PATH"
# Prepare compilation
cd poco
/mingw64/bin/cmake -G "MSYS Makefiles" ..
# Compile
make
编译成功并生成了库。
然后,在我的c ++项目的代码中,我使用POCO :: Data :: ODBC并将其注册为:
Poco::Data::ODBC::Connector::registerConnector();
应用程序已编译,但存在链接器错误:
undefined reference to `Poco::Data::ODBC::Connector::registerConnector()'
使用dllexp.exe检查库libPocoDataODBC.dll,我可以确认没有为Poco :: Data :: ODBC :: Connector :: registerConnector()定义入口点
是否知道图书馆中缺少入口点的原因?我的代码可以毫无问题地访问其他POCO库。 IT仅影响Poco :: Data :: ODBC。
Note:我正在将librares与参数链接-lPocoDataODBC -lPocoData -lPocoNet -lPocoJSON -lPocoUtil -lPocoFoundation -lPocoNetSSL -lPocoXML
我可以在this question看到类似的问题,但没有答案...
我刚刚找到了解决方案。我把它留在这里,以防万一有人觉得有用。