Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"operator delete", referenced from:
-[RCTJSCExecutor dealloc] in libReact.a(RCTJSCExecutor.o)
executeRandomAccessModule(RCTJSCExecutor_, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
readRAMBundle(std::__1::unique_ptr<__sFILE, int (_)(__sFILE_)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
RandomAccessBundleData::~RandomAccessBundleData() in libReact.a(RCTJSCExecutor.o)
"operator new", referenced from:
executeRandomAccessModule(RCTJSCExecutor_, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
readRAMBundle(std::__1::unique_ptr<__sFILE, int (_)(__sFILE_)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___gxx_personality_v0", referenced from:
-[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o)
RCTNSErrorFromJSError(RCTJSCWrapper_, OpaqueJSContext const_, OpaqueJSValue const*) in libReact.a(RCTJSCExecutor.o)
+[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor initWithUseCustomJSCLibrary:] in libReact.a(RCTJSCExecutor.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
solved the problem by removing MyProjectTest from Target, but only relevant if you don't write tests for your project...
I getting this error after react-native link & pod install
pod 'GoogleMaps'
pod 'Fabric'
pod 'Crashlytics'
see if -lc++ is added to Other linker flags for your test target. Feel free to close this issue if it's resolved for you.
@chirag04 unfortunately it's not working for me, i'm already have -lc++
@greenteamer Was just fighting the same issue, then realised that I needed to add the -lc++ flag to my test target, as it was missing from there, rather than from my apps target.
Hope that helps
Can you please elaborate on how to set -lc++ in otherLinker flags in test target.
Same problem. And it happens even when I:
Then the project won't start anymore and will give 14 errors together with the same problem Undefined symbols for architecture x86_64
@rogerkerse Same for me. Please let know when solve that. Removed tests for now...
@rogerkerse @alvelig https://github.com/facebook/react-native/issues/8880#issuecomment-236994554 this worked for me! :)
@greenteamer I deleted the tests target and no longer receive the error - the build is now succeeding. I'd like to write tests at some point. Is there another known solution for this?
adding lc++ to the other linker flags worked for me
@akshay2604 : in the xcode project navigator (leftmost option in the sidebar), select the project - the topmost item in the hierarchy
there should be a dropdown in the top left that lets you select the target - select the test target, and navigate to 'build settings' > 'all' .. you should see a 'other linker flags' line that you can add an item to
How can I set the linker flag manually? My xcode instance constantly crashes as soon as i try to add the flag to the test target within the ui editor.
@kevindavis Thanks for your instructions about how to globally set the linker flags! I have been following instructions all over the place for this, and no joy - I must have missed one somewhere. Your instructions saved the day!
Most helpful comment
see if
-lc++is added toOther linker flagsfor your test target. Feel free to close this issue if it's resolved for you.