I received these errors after I added " -all_load " in the "Other Linker Flags" build setting once I added "libPusher-combined.a" and its header files. I followed the instructions exactly up to the part of typing in "-all_load" (under "Using a pre-compiled static library" in the "Adding to your iOS Project", but I ended up getting 20 Mach-O Linker errors. :/ Could anyone please help me with this?
Here are the errors:
Undefined symbols for architecture armv7:
"_utf8_nextCharSafeBody", referenced from:
-[SRWebSocket _pumpScanner] in libPusher-combined.a(SRWebSocket.o)
"_SCError", referenced from:
-[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
"_utf8_countTrailBytes", referenced from:
-[SRWebSocket _pumpScanner] in libPusher-combined.a(SRWebSocket.o)
"_SCNetworkReachabilitySetDispatchQueue", referenced from:
-[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
-[Reachability stopNotifier] in libPusher-combined.a(Reachability.o)
"_kCFHTTPVersion1_1", referenced from:
-[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageIsHeaderComplete", referenced from:
___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageCreateRequest", referenced from:
-[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[Reachability reachabilityWithAddress:] in libPusher-combined.a(Reachability.o)
"_SCErrorString", referenced from:
-[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
"_SCNetworkReachabilityCreateWithName", referenced from:
+[Reachability reachabilityWithHostname:] in libPusher-combined.a(Reachability.o)
"_CFHTTPMessageCopyAllHeaderFields", referenced from:
___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageGetResponseStatusCode", referenced from:
-[SRWebSocket _HTTPHeadersDidFinish] in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageSetHeaderFieldValue", referenced from:
-[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
___25-[SRWebSocket didConnect]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageCreateEmpty", referenced from:
-[SRWebSocket _readHTTPHeader] in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageCopySerializedMessage", referenced from:
-[SRWebSocket didConnect] in libPusher-combined.a(SRWebSocket.o)
"_SCNetworkReachabilitySetCallback", referenced from:
-[Reachability startNotifier] in libPusher-combined.a(Reachability.o)
-[Reachability stopNotifier] in libPusher-combined.a(Reachability.o)
"_SCNetworkReachabilityGetFlags", referenced from:
-[Reachability isReachable] in libPusher-combined.a(Reachability.o)
-[Reachability isReachableViaWWAN] in libPusher-combined.a(Reachability.o)
-[Reachability isReachableViaWiFi] in libPusher-combined.a(Reachability.o)
-[Reachability connectionRequired] in libPusher-combined.a(Reachability.o)
-[Reachability isConnectionOnDemand] in libPusher-combined.a(Reachability.o)
-[Reachability isInterventionRequired] in libPusher-combined.a(Reachability.o)
-[Reachability reachabilityFlags] in libPusher-combined.a(Reachability.o)
...
"_CFHTTPMessageCopyHeaderFieldValue", referenced from:
-[SRWebSocket _checkHandshake:] in libPusher-combined.a(SRWebSocket.o)
"_CFHTTPMessageAppendBytes", referenced from:
___30-[SRWebSocket _readHTTPHeader]_block_invoke_0 in libPusher-combined.a(SRWebSocket.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If you need more information, just ask. I hope that I'm not giving too much trouble. Thanks in advance.
Can you check out in your target->Build Phase. whether these files exist there or not ? and if you are running for simulator then first you need to make a build for simulator of that library whatever i guess you are using SRWebSocket library. Just open that project and just make a build for simulator and copy the files from build folder and then add to your project and do the same for the device if you are running your app on device.
Check to make sure you included the following frameworks (via https://github.com/square/SocketRocket) :
Framework Dependencies
Your .app must be linked against the following frameworks/dylibs
libicucore.dylib CFNetwork.framework Security.framework Foundation.framework
Make sure that you also have -licucore in "Other Linker Flags", in the build settings tab, as in the attached screenshot:
I copied the complete SocketRocket folder into my application for using web sockets in my application and linked libicucore.dylib, CFNetwork.framework, Security.framework, Foundation.framework binaries with my project. This removed all my errors and warnings.
For the latest sdk, you should add:
libicucore.tbd
since libicucore.dylib is not present anymore.
hope .tbd extension is not for "to be delete"?
In my case when I added SystemConfiguration.framework to the project and problem went... :-)
来源:https://stackoverflow.com/questions/9931510/apple-mach-o-linker-errors-20-undefined-symbols-for-architecture-armv7