最简单的代码:test.cpp
#include "ace/OS_NS_string.h"
#include "ace/ACE.h"
#include "ace/OS.h"
#include "ace/Select_Reactor.h"
int main(int argc, char* argv[])
{
ACE_Select_Reactor tp_reactor;
//return S1(argc, argv);
return 0;
}
使用:g++ test.cpp -o test -lACE
出现:
/tmp/ccC7FYGs.o(.gnu.linkonce.t._ZN6ACE_OS6memcpyEPvPKvj+0x13): In function `ACE_OS::memcpy(void*, void const*, unsigned int)':
: undefined reference to `ACE_OS::fast_memcpy(void*, void const*, unsigned int)'
collect2: ld returned 1 exit status
之前曾经编译过一些例子代码都成功,环境变量已经设置:
ACE_ROOT=/home/test/ace/ACE_wrappers
export ACE_ROOT
LD_LIBRARY_PATH=$ACE_ROOT/ace:$ACE_ROOT/lib:/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
libACE.so安装在/usr/local/lib/中,代码也包含了ace/OS.h,为什么会出现无定义引用错误? |