Xcode“架构i386的未定义符号”错误,代码没有任何变化,突然[重复]

时间:2023-02-07 09:39:03

This question already has an answer here:

这个问题在这里已有答案:

I get the Undefined symbols for architecture i386. Here's what I did:

我得到架构i386的Undefined符号。这是我做的:

  1. I checked many times for miswriting .h or .m extensions.

    我多次检查错误.h或.m扩展名。

  2. I deleted Framework Search Paths and then wrote ./ being defined as "Recursive" as it was provided as a solution but it did not work either.

    我删除了框架搜索路径,然后将./定义为“递归”,因为它是作为解决方案提供的,但它也不起作用。

  3. Architecture settings is now set as $(ARCHS_STANDARD).

    架构设置现在设置为$(ARCHS_STANDARD)。

    Undefined symbols for architecture i386:
    "_OBJC_CLASS_$_EMDenemeSinaviCell", referenced from:
         __TFC8EduMobil24EMAssesmentEvaluationNEW9tableViewfS0_FTCSo11UITableView21cellForR        owAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell in         EMAssesmentEvaluationNEW.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
  4. When i change the current Cell Class i am using to another Cell Class it does not give any error. But it gives the following warning:

    当我将当前使用的Cell Class更改为另一个Cell Class时,它不会给出任何错误。但它给出了以下警告:

    file was built for i386 which is not the architecture being linked (x86_64): 
    

How can I solve this error?

我该如何解决这个错误?

4 个解决方案

#1


You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

如果您的类'.m文件未列在目标“Build Phases”选项卡的“Compile Sources”步骤下,则可能会出现此类错误。通常Xcode会为您执行此操作,但有时会丢失绘图,您需要手动添加.m文件。

To do this:

去做这个:

TargetSettings -> Build Phases -> Compile Sources -> add your .m class ->Build and Ru

TargetSettings - > Build Phases - > Compile Sources - >添加你的.m类 - > Build和Ru

#2


Are you using any frameworks or libraries that don't come from Apple? Sub-projects? This looks like you're using a static or dynamic library that is only available for actual iOS devices or for 64-bit, or only for Mac OS X and trying to build it for the 32-bit iOS simulator (which is 32-bit Intel, hence the "i386").

您使用的是不是Apple的任何框架或库吗?分项目?这看起来像您使用的静态或动态库仅适用于实际iOS设备或64位,或仅适用于Mac OS X并尝试为32位iOS模拟器(32位)构建它英特尔,因此“i386”)。

So I'd guess either you have picked a bad library, or you've selected a 32-bit simulator (e.g. iPhone 4S) but your app is for 64-bit phones/simulator only (e.g. iPhone 6).

所以我猜你要么选择了一个坏的库,要么你已经选择了32位模拟器(例如iPhone 4S),但你的应用只适用于64位手机/模拟器(例如iPhone 6)。

PS - Other guess, maybe your Schemes have been screwed up and it's trying to build your iOS project as Mac? What does your scheme selector say for the device? One of your devices? A simulator? "My Mac"?

PS - 其他的猜测,也许你的方案搞砸了,它正试图建立你的iOS项目作为Mac?您的方案选择器对设备说了什么?你的一个设备?一个模拟器? “我的Mac”?

#3


in Build Settings > "Valid Architectures" remove all unsupported architectures, like i386, x86_64m, etc.

在构建设置>“有效体系结构”中删除所有不受支持的体系结构,如i386,x86_64m等。

if your architectures will be only {armv7, armv7s, arm64} - it should work. do it in build settings > "Architectures" as well.

如果你的架构只有{armv7,armv7s,arm64} - 它应该可行。在构建设置>“架构”中也可以。

#4


This solution solved my problem,

这解决方案解决了我的问题

https://*.com/a/26561570/3924964

The implementation part was missing in Cell file. :(

Cell文件中缺少实现部分。 :(

#1


You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

如果您的类'.m文件未列在目标“Build Phases”选项卡的“Compile Sources”步骤下,则可能会出现此类错误。通常Xcode会为您执行此操作,但有时会丢失绘图,您需要手动添加.m文件。

To do this:

去做这个:

TargetSettings -> Build Phases -> Compile Sources -> add your .m class ->Build and Ru

TargetSettings - > Build Phases - > Compile Sources - >添加你的.m类 - > Build和Ru

#2


Are you using any frameworks or libraries that don't come from Apple? Sub-projects? This looks like you're using a static or dynamic library that is only available for actual iOS devices or for 64-bit, or only for Mac OS X and trying to build it for the 32-bit iOS simulator (which is 32-bit Intel, hence the "i386").

您使用的是不是Apple的任何框架或库吗?分项目?这看起来像您使用的静态或动态库仅适用于实际iOS设备或64位,或仅适用于Mac OS X并尝试为32位iOS模拟器(32位)构建它英特尔,因此“i386”)。

So I'd guess either you have picked a bad library, or you've selected a 32-bit simulator (e.g. iPhone 4S) but your app is for 64-bit phones/simulator only (e.g. iPhone 6).

所以我猜你要么选择了一个坏的库,要么你已经选择了32位模拟器(例如iPhone 4S),但你的应用只适用于64位手机/模拟器(例如iPhone 6)。

PS - Other guess, maybe your Schemes have been screwed up and it's trying to build your iOS project as Mac? What does your scheme selector say for the device? One of your devices? A simulator? "My Mac"?

PS - 其他的猜测,也许你的方案搞砸了,它正试图建立你的iOS项目作为Mac?您的方案选择器对设备说了什么?你的一个设备?一个模拟器? “我的Mac”?

#3


in Build Settings > "Valid Architectures" remove all unsupported architectures, like i386, x86_64m, etc.

在构建设置>“有效体系结构”中删除所有不受支持的体系结构,如i386,x86_64m等。

if your architectures will be only {armv7, armv7s, arm64} - it should work. do it in build settings > "Architectures" as well.

如果你的架构只有{armv7,armv7s,arm64} - 它应该可行。在构建设置>“架构”中也可以。

#4


This solution solved my problem,

这解决方案解决了我的问题

https://*.com/a/26561570/3924964

The implementation part was missing in Cell file. :(

Cell文件中缺少实现部分。 :(