xcode 1 个用于 x86_64 架构的重复符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49669403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:36:25  来源:igfitidea点击:

1 duplicate symbol for architecture x86_64

iosobjective-cxcodelinker-errors

提问by Hanz Cheah

I am not sure what I have done wrong.
I moved my project folder to another folder and copied the backup folder to desktop.
I tried to open the backup project and build, I received the linker error.
So I decided to I delete my backup folder and moved back my project folder to desktop. I can't compile anymore and received the following error.

我不确定我做错了什么。
我将我的项目文件夹移动到另一个文件夹并将备份文件夹复制到桌面。
我尝试打开备份项目并构建,但收到链接器错误。
所以我决定删除我的备份文件夹并将我的项目文件夹移回桌面。我无法再编译并收到以下错误。

 Showing Recent Issues clang: error: linker command failed with exit code 1 (use -v to see invocation)

duplicate symbol _main in:
/Users/BRO/Library/Developer/Xcode/DerivedData/SFITNESS-flzvwdymttxhducvwvmhpuaqfzhj/Build/Intermediates.noindex/SFITNESS.build/Debug-iphonesimulator/SFITNESS.build/Objects-normal/x86_64/main-90EC778DD760FD57.o
/Users/BRO/Library/Developer/Xcode/DerivedData/SFITNESS-flzvwdymttxhducvwvmhpuaqfzhj/Build/Intermediates.noindex/SFITNESS.build/Debug-iphonesimulator/SFITNESS.build/Objects-normal/x86_64/main-F627C2B37F247040.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)  

Help Needed

需要帮助

No derived data folder

没有派生数据文件夹

pic

图片

Still the same

还是一样

1. I opened Derived Data folder and deleted everything in it
2. I deletes all the project in all simulator
3. I restarted xCode, Clean and build

1. 我打开了 Derived Data 文件夹并删除了其中的所有内容
2. 我删除了所有模拟器中的所有项目
3. 我重新启动了 xCode,清理并构建

Still the same Pic 2

还是一样 图2

Added the project into GitHub

将项目添加到 GitHub

The link

链接

采纳答案by Md Rashed Pervez

You need to add necessary framework to your project. Check all third party party framework and search its required framework for support. For e.g. if you add google analyticthen you need to add CoreData, Foundationetc framework. There is some framework is missing for which third party framework needs.

您需要为您的项目添加必要的框架。检查所有第三方框架并搜索其所需的框架以获得支持。对于例如,如果你加google analytic那么你需要add CoreDataFoundation等框架。缺少某些第三方框架需要的框架。

Or you can-

或者你可以——

  1. Press "Cmd + Shift + K"or shift + cmd + alt + kto clean up, and quit Xcode.
  2. Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData"in terminal

  3. Open the project and re-build it

  1. "Cmd + Shift + K"shift + cmd + alt + k进行清理,然后退出 Xcode。
  2. 删除缓存"rm -rf ~/Library/Developer/Xcode/DerivedData"在终端运行

  3. 打开项目并重新构建它

Linker command failed with exit code 1- to solve this error press "Cmd + Shift + K"or shift + cmd + alt + kthis will do the work for you. I also have this same issue but solved by using this line . Hope this will solve your problem.

Linker command failed with exit code 1- 要解决此错误,请按"Cmd + Shift + K"shift + cmd + alt + k这将为您完成工作。我也有同样的问题,但通过使用这条线解决了。希望这能解决您的问题。

OUTPUT OF YOUR PROJECT -

您项目的输出 -

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by a.masri

I have cloned your project from github, I found that the main.mfile is repeated in SFITNESSand CERangeSliderYou may delete one of them and your project will work.

我已经从 github 克隆了您的项目,我发现该main.m文件在其中重复SFITNESSCERangeSlider您可以删除其中之一,您的项目将起作用。

回答by Shaheen M Basheer

duplicate symbol _main

You have two main.m files and the function main() is in conflict.

您有两个 main.m 文件,并且函数 main() 存在冲突。

enter image description here

在此处输入图片说明

Just delete the main.m under CERangeSlider and it should work.

只需删除 CERangeSlider 下的 main.m 就可以了。

回答by dahiya_boy

how to get derived data

怎么获得 derived data

  • Open Xcode.
  • Open Xcode preferences (Cmd + ,)
  • Select location option.
  • now you have scene, now click on the point as shown in below image.

    enter image description here

  • your derived data is now opened (suggest you to add drive data in finder left menu). Delete whatever inside the drive data.

  • now delete your project from simulator.
  • clean and build your project.
  • 打开 Xcode。
  • 打开 Xcode 首选项 ( Cmd + ,)
  • 选择位置选项。
  • 现在你有了场景,现在点击下图所示的点。

    在此处输入图片说明

  • 您的派生数据现已打开(建议您在查找器左侧菜单中添加驱动器数据)。删除驱动器数据中的任何内容。

  • 现在从模拟器中删除您的项目。
  • 清理并构建您的项目。

If you are still facing issues then let us know so that we can help accordingly.

如果您仍然遇到问题,请告诉我们,以便我们可以提供相应的帮助。