Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problems linking dynamic libraries in Mac OSX(The g++/clang require appears to require a -lc++ flag and I do not know how to set this using the IDE)
Problems linking dynamic libraries in Mac OSX [message #1730155] Thu, 21 April 2016 19:52
Marcus Haupt is currently offline Marcus HauptFriend
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



Previous Topic:GDB Hardware Debugging does not Suspend
Next Topic:GoogleTest reports all unit tests passing. This is not the case
Goto Forum:
  


Current Time: Tue Mar 19 04:06:52 GMT 2024

Powered by FUDForum. Page generated in 0.01904 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top