Undefined symbols for architecture armv7

2018-12-31 02:23发布

This problem has been driving me crazy, and I can't work out how to fix it...

    Undefined symbols for architecture armv7:
  "_deflateEnd", referenced from:
      -[ASIDataCompressor closeStream] in ASIDataCompressor.o
  "_OBJC_CLASS_$_ASIDataDecompressor", referenced from:
      objc-class-ref in ASIHTTPRequest.o
  "_deflate", referenced from:
      -[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
  "_deflateInit2_", referenced from:
      -[ASIDataCompressor setupStream] in ASIDataCompressor.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

I think it has to do with:

ld: symbol(s) not found for architecture armv7

But I have added: libz.1.2.3.dylib and it's not helping, anyone got any ideas?

标签: ios armv7
30条回答
残风、尘缘若梦
2楼-- · 2018-12-31 02:46

I received the 'Undefined symbols for architecture armv7:' error when trying to compile a project that had the target build setting for 'C++ Standard Library' set to 'libc++' (necessary as the project was using some features from C++ 11), and the project included a sub-project that had the same setting set to 'libstdc++' (or compiler default as it is currently).

Changing the sub-project's 'C++ Standard Library' setting to libc++ fixed it, but only after first setting the deployment target for the sub-project to 5.0 or above (5.0 is necessary for libc++).

查看更多
骚的不知所云
3楼-- · 2018-12-31 02:47

I got this problem when I run app on iphone5s, it was solved by add arm64 to Architectures.

查看更多
零度萤火
4楼-- · 2018-12-31 02:47

If you're building from Unity3D 5 and also using a Prime31 plugin and you're getting this error it's probably due to a duplicate .dll. If you look through your warnings in Unity's editor one of them will tell you this and warn that it could cause build errors. To see if this is the case, type P31 in your project search field and it should pop right up, maybe even more than one. The duplicate's will have a ' 1' at the end of the file name. This is probably caused from updating the plugin in editor via the store or the Prime31 menu tab.

查看更多
残风、尘缘若梦
5楼-- · 2018-12-31 02:49

I had a similar issue last night and the problem, was related to the fact that I had dragged a class from the Finder to my project in Xcode.

The solution was to go the the Build Phases tab and then the Compile Sources and make sure you drag the class to the list.

查看更多
萌妹纸的霸气范
6楼-- · 2018-12-31 02:50

In my case, I'd added a framework that must be using Objective C++. I found this post:

XCode .m vs. .mm

that explained how the main.m needed to be renamed to main.mm so that the Objective-C++ classes could be compiled, too.

That fixed it for me.

查看更多
梦寄多情
7楼-- · 2018-12-31 02:51

Probably some classes are missing from your target. This usually happens when you rename/remove/add new classes files to your project. To fix add the newly added classes to some targets.

Select the class in the Project Navigator (right sidebar) , open the Utilities sidebar (right sidebar), from the Utilities select the File Inspector (file like icon), under the Target Membership tab tick your targets. This is all to avoid the "Remove reference" and add again with ticking "Add to targets" trick.

So: Select Class -> Utilities (File Inspector) -> Target Membership -> Tick the targets you want.

查看更多
登录 后发表回答