New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined symbols using g++-6 on OS X #597
Comments
Best guess: some preprocessor macro is different when you compile from when brew compiled the library. |
Some updates: A. I replaced
Got similar error:
B. If I build jsoncpp from source with g++-6, then link to the library. It works fine. My current guess is that by default, llvm and g++-6 use different compiler settings. And the iostream related stuff is very suspicious. But I could not find out the exact thing that causes the conflicts. I did this (install libraries using brew/compile with llvm, then build code with g++-6 and link to the library) for other libraries include glew and glfw. They all work fine. Jsoncpp is the first library for which I encountered this problem. |
Update: I think it is the conflict between libc++ and libstdc++ when using I tried to build a minimal library with only one function:
And an app that uses this library:
However, to solve my problem. I need to either let g++-6 link to libc++, or let brew build with "-stdlib=libstdc++". Both I don't know how to do it. |
That's great detective work. But what can we do about it? |
There are some discussion on stackoverflow too: In general, it is bad practice to mix libraries linked against This is done with: I think we can close this ticket. The information here should be sufficient for someone to figure out a workaround if he encounters similar issues in the future. @cdunn2001 thanks for the help! |
OS X El Capitan, installed gcc6 and jsoncpp via homebrew:
Then build the following code:
Using command:
Error:
Note:
Json::StyledStreamWriter
related stuff were removed from the code, it works fine.The text was updated successfully, but these errors were encountered: