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

240 views Asked by At

I am trying to compile and run the following simple code in MAC OS X 10.9 with CLANG++:

#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:

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.

Thanks,

Moamen

1

There are 1 answers

0
Johnny Willemsen On BEST ANSWER

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. Seems some default libs were missing!