C++ CppUnit 上的链接器错误

发布于 2024-12-27 14:40:25 字数 339 浏览 1 评论 0原文

我正在尝试编译 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

驱逐舰岛风号 2025-01-03 14:40:25

标头中的内容是函数声明,而不是其定义。
链接器抱怨,因为它找不到函数的定义,该函数可能位于您未链接的库文件中。

将库链接到您的项目。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文