Link with static library fails under OSX

Hi,

I cannot compile the example for the static library under OSX (10.11.4, fully updated).

First, the makefile is wrong, I had to add all the framework and change the path of the library libTurboActivate.a:

example: example.o g++ $(CXXFLAGS) -o a.out example.o ../../libTurboActivate.a -lcurl -framework CoreFoundation -framework CoreServices -framework Foundation -framework IOKit -framework SystemConfiguration

But now it cannot links against my system stdlib, I got a bunch of undefined reference like that:

Undefined symbols for architecture x86_64: "std::string::find_last_not_of(char const*, unsigned long) const", referenced from: TrimStr(std::string const&) in libTurboActivate.a(Trial.o) "std::string::find_first_not_of(char const*, unsigned long) const", referenced from: TrimStr(std::string const&) in libTurboActivate.a(Trial.o) "std::string::substr(unsigned long, unsigned long) const", referenced from: Activation::IsKeyValid(char*, int) in libTurboActivate.a(Activation.o) Trial::IsOnlineTrialKeyValid(char const*) in libTurboActivate.a(Trial.o) TrimStr(std::string const&) in libTurboActivate.a(Trial.o)

.... and so on.

I tried adding the isysroot path, tell clang to use c++11,... Nothing works 🙁

Can you help me please ?

Cheers

Err, I forgot to add -lstdc++

Sorry for the useless question 😉

That's no problem.

Hi,

I'm back with my problem 😉

As I said, I managed to compile the example. But now, I have the same issue in my project with the same undefined reference to the libc++ 🙁

Any hints ?

Also, are you building the TurboActivate library with libc++ or stdlibc++, it looks like it could be a problem when you link code compiled with stdlibc++ with code linked with libc++ (and vice versa).

Thanks, cheers

You need to use libstdc++ (the GNU c++ standard library) because that's what the static TurboActivate libraries are compiled with (for backwards compatibility).

Hi,

Thanks for the reply...I'm trying to compile a recent version of gcc because the libstdc++ from the system is too old for our project 🙁

Otherwise is there a way to get a TurboActivate static library compiled against the libc++ ?

Cheers

Hi again 😉

I finally used the dynamic version and it's working fine...

Thanks