简体   繁体   English

ACE在MAC OS X 10.9(及更高版本)中的链接器上失败

[英]ACE fails at Linker in MAC OS X 10.9 (and higher)

I am trying to compile and run the following simple code in MAC OS X 10.9 with CLANG++: 我正在尝试使用CLANG ++在MAC OS X 10.9中编译并运行以下简单代码:

#include "ACE_wrappers/ace/MEM_Stream.h"
#include <iostream>

int main()
{
        std::cout << "Hello World" << std::endl;
        ACE_MEM_Stream m(3);
        m.close_reader();
        return 0;
}

But I get the following error: 但是我收到以下错误:

QAs-MacBook:aceTestLinking Moamen$ clang++ myTest.cpp 
Undefined symbols for architecture x86_64:
  "ace_os_main_i(int, char**)", referenced from:
       _main in moamen-511a28.o
  "ACE_SOCK::ACE_SOCK()", referenced from:
       ACE_MEM_IO::ACE_MEM_IO() in moamen-511a28.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The compile line: 编译行:

clang++ myTest.cpp

The CLANG Compiler version I am using: 我正在使用的CLANG编译器版本:

QAs-MacBook:aceTestLinking Moamen$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

Notice - I have also tried to compile with "-std=c++11", "-stdlib=libstdc++", as in the following topic: C++ linking error after upgrading to Mac OS X 10.9 / Xcode 5.0.1 but did not solve the issue. 注意-我也曾尝试使用“ -std = c ++ 11”,“-stdlib = libstdc ++”进行编译,如以下主题所示: 升级到Mac OS X 10.9 / Xcode 5.0.1后,C ++链接错误,但是没有解决问题。

Thanks, 谢谢,

Moamen Moamen

Thanks for the replies, after some investigation on Linux Ubuntu, I succeeded to compile the code with the following command g++ -o m.out myTest.cpp ACE_wrappers/lib/libACE.a -I ACE_wrappers/ -lpthread -ldl. 感谢您的答复,在对Linux Ubuntu进行了调查之后,我成功使用以下命令g编译了代码-o m.out myTest.cpp ACE_wrappers / lib / libACE.a -I ACE_wrappers / -lpthread -ldl。 Seems some default libs were missing! 似乎缺少一些默认库!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM