C++ CppUnit 上的链接器错误
我正在尝试编译 CppUnit 的扩展库。
但链接时出现以下错误:
DatabaseAssert.cp:(.text+0x782): undefined reference to 'CppUnit::DatabaseAssert::getDBConnection(DBAdapter*)'
包含的头文件具有定义:
static oracle::occi::Connection* getDBConnection(DBAdapter *dbAdapter);
为什么我仍然得到的任何线索未定义的引用
错误?
I'm trying to compile an extension library for CppUnit.
But it gives me the following error while linking:
DatabaseAssert.cp:(.text+0x782): undefined reference to 'CppUnit::DatabaseAssert::getDBConnection(DBAdapter*)'
The included header file has the definition :
static oracle::occi::Connection* getDBConnection(DBAdapter *dbAdapter);
Any clues why I am still getting the undefined reference
error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标头中的内容是函数声明,而不是其定义。
链接器抱怨,因为它找不到函数的定义,该函数可能位于您未链接的库文件中。
将库链接到您的项目。
What you have in the header is the function declaration, not its definition.
The linker is complaining because it cannot find the definition of the function which is probably in the library file which you did not link.
Link the library to your project.