POCO库:MinGW(MSYS2)编译生成的libPocoDataODBC.dll缺少入口点(POCO::Data::ODBC::Connector::registerConnector)

POCO库:MinGW(MSYS2)编译生成的libPocoDataODBC.dll缺少入口点(POCO::Data::ODBC::Connector::registerConnector),dll,cmake,odbc,mingw-w64,poco-libraries,Dll,Cmake,Odbc,Mingw W64,Poco Libraries,我已经成功地使用MinGW64(MSYS2)编译了POCO库。 为了构建它,我安装了Windows SDK并将路径添加到PATH环境中,mc.exe,因此我执行了: 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 (x8

我已经成功地使用MinGW64(MSYS2)编译了POCO库。 为了构建它,我安装了Windows SDK并将路径添加到PATH环境中,
mc.exe
,因此我执行了:

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::DAT::ODBC,并登记为:

Poco::Data::ODBC::Connector::registerConnector();
应用程序已编译,但存在链接器错误:

undefined reference to `Poco::Data::ODBC::Connector::registerConnector()'
使用dllexp.exe检查库libPocoDataODBC.dll,我可以确认没有为Poco::Data::ODBC::Connector::registerConnector()定义入口点

你知道图书馆缺少入口点的原因吗? 我的代码可以毫无问题地访问其他POCO库。它只影响Poco::Data::ODBC

注意:我正在用参数链接天秤座
-lpocodbc-lPocoData-lPocoNet-lPocoJSON-lpocoiutil-lpocoofoundation-lpoconetsl-lPocoXML


我可以在上看到一个类似的问题,但没有答案…

我刚刚找到了解决方案。我把它放在这里,以防万一有人觉得有用

编译数据/ODBC文件时会出现一些警告:类似

在没有dllimport属性的情况下重新声明:忽略以前的dllimport

用于文件
Data\ODBC\src\Extractor.cpp
Data\ODBC\src\Preparator.cpp

不管这些警告如何,都会编译这些文件。但是,当生成库时,它缺少入口点,正如我的问题中所揭示的那样

解决方案是在
Data\ODBC\src\Extractor.cpp
Data\ODBC\src\Preparator.cpp的开头添加
,包括“Poco/Foundation.h”

我可以从这里猜出来