-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Error on the Mac: Undefined symbols for architecture x86_64 #285
Comments
This is very strange, because all code is checked by Travis, including Xcode 7.3 (see https://travis-ci.org/nlohmann/json/jobs/146965482), so I currently cannot reproduce the error. Could you please post the complete file |
i simplified file: < compare-vectors.cpp #include "json.hpp"
int main(void) {
using json = nlohmann::json;
// create object from string literal
auto j3 = json::parse("{ \"happy\": true, \"pi\": 3.141 }");
}
|
Could you try to execute The error message seems similar to issue reported here: http://stackoverflow.com/questions/19637164/c-linking-error-after-upgrading-to-mac-os-x-10-9-xcode-5-0-1 - you may want to try to add |
i tried both i use it's not ideal but i can live with it |
I know this is an old issue, but just for resolution: using g++/clang++ in place of gcc/clang solves the issue. |
Google led me to this thread once again, and replacing |
Yes, you need to using clang++ for name mangling purposes. |
Switching from gcc to g++ to compile solved this issue for me (for a non-JSON issue, but similar issue). Thank you so much @WikiWikiWang ! |
Thank you @WikiWikiWang, switching to g++ instead of gcc solves my issue. THANKS a lot! |
I installed json with brew (brew tap nlohmann/json && brew install nlohmann_json).
then i wrote hello world:
finnaly i ran clang:
clang -std=c++11 -O3 compare-vectors.cpp -o compare-vectors
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
The text was updated successfully, but these errors were encountered: