linking with clang++ on OS X generates lots of symbol not found errors

后端 未结 2 1976
清歌不尽
清歌不尽 2020-11-28 09:55

I\'m trying to compile some C++ code (including C++11 features) on OS X 10.8 using the clang++ compiler. I have a makefile that generates the object files OK, then on the co

相关标签:
2条回答
  • 2020-11-28 10:19

    I suspect this issue is because of the two C++ runtime libraries available under OS X. Use the following to link the dynamic library:

    clang++ -stdlib=libc++ -o Analysis.dylib -shared DataFile.o CR39DataFile.o
    

    (the -stdlib=libc++ being the key difference). I think the default C++ runtime is the GNU implementation which is confusing the linker as you compiled with the libc++ implementation.

    0 讨论(0)
  • 2020-11-28 10:23

    As a side note, faced with the same error message, I discovered I needed to use gcc -lstdc++ -lLibraryName ... (the stdc++ part being needed).

    See also https://github.com/JonathanSalwan/Triton/issues/243

    0 讨论(0)
提交回复
热议问题