Problems linking dynamic libraries in Mac OSX [message #1730155] |
Thu, 21 April 2016 19:52 |
Marcus Haupt Messages: 1 Registered: April 2016 |
Junior Member |
|
|
I can compile a Mac OS dynamic C++ link library (.dylib) using Eclipse but I can't figure out how to get the IDE to send the proper commands to link it with an app also written in the IDE even though I can link and run successfully from the command line using the same Xcode toolchain which calls g++/clang.
Eclipse produces:
g++ -L/mylibdir -o target ./src/target.o -l/mylibdir/testDll.dylib
ld: library not found /mylibdir/testDll.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-After verifying the DYLD_LIBRARY_PATH was set properly I looked at the linker's output in -Wall mode and saw it uses a "-lc++" flag when it links my app with the libclang_rt.osx.a library. So I used the -lc++ flag to link my app with with dynamic library on the command line and g++/clang links it successfully. No run-time errors when the app executes and it produces the expected results.
I checked online and couldn't find anything that exactly fit my situation. I created the files using Eclipse->file->new->new project->c++ project-shared library->MAC OSX GCC
I'm hoping that either
1. there's a way for the IDE to set the flag -lc++ when linking the .dylib
2. there's a C++ toolchain for the Mac that works better with eclipse than Xcode
3. There's an entirely different path I could take that would obviate the problem completely
any help, advice or suggestions would be greatly appreciated
|
|
|
Powered by
FUDForum. Page generated in 0.01904 seconds