POCO库:MinGW(MSYS2)编译已生成缺少入口点的libPocoDataODBC.dll(Poco :: Data :: ODBC :: Connector :: registerConnector) [英] POCO libraries: MinGW (MSYS2) compilation has generated libPocoDataODBC.dll with missing entry points (Poco::Data::ODBC::Connector::registerConnector)

查看:552
本文介绍了POCO库:MinGW(MSYS2)编译已生成缺少入口点的libPocoDataODBC.dll(Poco :: Data :: ODBC :: Connector :: registerConnector)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have succeeded compiling POCO libraries with MinGW64 (MSYS2). To build it, I installed Windows SDK and added to the PATH environment the path to mc.exe, so I executed:

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并将其注册为:

Then, in the code of my c++ project, I use POCO::Data::ODBC and register it with:

Poco::Data::ODBC::Connector::registerConnector();

应用程序已编译,但存在链接器错误:

The application compiles, but there is a linker error:

undefined reference to `Poco::Data::ODBC::Connector::registerConnector()'

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

Inspecting the library libPocoDataODBC.dll with dllexp.exe I can confirm there is no entry point defined for Poco::Data::ODBC::Connector::registerConnector()

您是否知道图书馆中缺少入口点的原因? 我的代码可以毫无问题地访问其他POCO库. IT仅影响Poco :: Data :: ODBC.

Any idea of the reason of this lack of entry points in the library? My code accesses other POCO libraries with no problem. IT only affects Poco::Data::ODBC.

注意:我正在将librares与参数链接 -lPocoDataODBC -lPocoData -lPocoNet -lPocoJSON -lPocoUtil -lPocoFoundation -lPocoNetSSL -lPocoXML

Note: I'm linking the librares with parameters -lPocoDataODBC -lPocoData -lPocoNet -lPocoJSON -lPocoUtil -lPocoFoundation -lPocoNetSSL -lPocoXML

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

I can see a similar question at this question but with no answer...

推荐答案

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

I've just found the solution. I leave it here just in case someone finds it useful.

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

There are some warnings compiling files for Data/ODBC: something like

redeclared without dllimport attribute: previous dllimport ignored

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

不管这些警告如何,文件都会被编译.但是在生成库时,它缺少入口点,如我的问题中所述.

Regardless these warnings, the files are compiled. But when the library is generated it lacks of entry points, as exposed in my question.

解决方案是在Data\ODBC\src\Extractor.cppData\ODBC\src\Preparator.cpp的开头添加#include "Poco/Foundation.h".

The solution is to add #include "Poco/Foundation.h" at the beginning of Data\ODBC\src\Extractor.cpp and Data\ODBC\src\Preparator.cpp.

我可以从 poco问题中猜出来.

这篇关于POCO库:MinGW(MSYS2)编译已生成缺少入口点的libPocoDataODBC.dll(Poco :: Data :: ODBC :: Connector :: registerConnector)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆