构建 ACE 程序时出错
我刚刚启动了 ACE 的“HELLO WORLD”程序。它编译成功,但在构建时产生了一些错误。任何人都可以帮助我。 代码:
#include <stdio.h>
#include "ace/Log_Msg.h"
#include "ace/OS_main.h"
int ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
ACE_DEBUG((LM_DEBUG, "Hello World\n"));
return 0;
}
错误:
/tmp/cccwdbA0.o:在函数“main”中: hello.cpp:(.text+0xa): 对 `ACE_Log_Msg::last_error_adapter()' 的未定义引用
hello.cpp:(.text+0x13): 对 `ACE_Log_Msg::instance()' 的未定义引用
hello.cpp:(.text+0x43): 对 `ACE_Log_Msg::conditional_set(char const*, int, int, int)' 的未定义引用
hello.cpp:(.text+0x5f): 对 `ACE_Log_Msg::log(ACE_Log_Priority, char const*, ...)' 的未定义引用
collect2: ld 返回 1 退出状态
编译失败。
i just started ACE with a "HELLO WORLD" program. It compiled successfully but while building it produces some of the errors.Can anyone help me.
CODE:
#include <stdio.h>
#include "ace/Log_Msg.h"
#include "ace/OS_main.h"
int ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
ACE_DEBUG((LM_DEBUG, "Hello World\n"));
return 0;
}
ERROR:
/tmp/cccwdbA0.o: In function `main':
hello.cpp:(.text+0xa): undefined reference to `ACE_Log_Msg::last_error_adapter()'
hello.cpp:(.text+0x13): undefined reference to `ACE_Log_Msg::instance()'
hello.cpp:(.text+0x43): undefined reference to `ACE_Log_Msg::conditional_set(char const*, int, int, int)'
hello.cpp:(.text+0x5f): undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char const*, ...)'
collect2: ld returned 1 exit status
Compilation failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有看到构建命令,很难判断,但看起来您没有添加对 ACE 库的链接时引用。
Without seeing the build commands it's hard to tell but it looks like you didn't add a link-time reference to the ACE library.
很难说你做了什么才让这件事不起作用。如果我猜的话,看起来好像您已经更新了 makefile 中的包含路径,但忘记将 libACE.so 链接到您的项目。这将导致您看到未定义的编译行为。
It's hard to tell what you've done to make this not work. If I were to guess, it looks as if you've updated your include path in your makefile but forgotten to link libACE.so to your project. This would result in the undefined compilation behaviour you're seeing.