I was working on my project and suddenly after editing the code and compiling gave this error:
我正在做我的项目,突然在编辑代码和编译后出现了这个错误:
ld: warning: directory not found for option '-
L/Users/mani/Documents/Classes/Twitter+OAuth/Libraries & Headers' ld: duplicate symbol _OBJC_CLASS_$_playSiew in /Users/mani/Library/Developer/Xcode/DerivedData/learn-aktrtiwswclovoatyweyquoxmypa/Build/Intermediates/learn.build/Debug-iphonesimulator/learn.build/Objects-normal/i386/playSiew.o and /Users/mani/Library/Developer/Xcode/DerivedData/learn-aktrtiwswclovoatyweyquoxmypa/Build/Intermediates/learn.build/Debug-iphonesimulator/learn.build/Objects-normal/i386/Thumb.o for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)警告:没有为选项找到的目录'- L/Users/mani/Documents/Classes/Twitter+OAuth/Libraries & header ' ld: duplicate symbol _objc_class_class_$ playSiew in /Users/ Library/Developer/Xcode/DerivedData/ learndatn - aktrtiwswclovotype - weyquoxmypa/Build - Build -新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建/新建o和/用户/摩尼/图书馆/开发/ Xcode / DerivedData / learn-aktrtiwswclovoatyweyquoxmypa /构建/中间体/ learn.build / Debug-iphonesimulator / learn.build / Objects-normal / i386 /拇指。o为架构i386的clang: error: linker命令失败,退出代码1(使用-v查看调用)
I never touched the project settings, just edited the code.
我从未碰过项目设置,只是编辑了代码。
What's more strange is that I took out last revised code from svn but still I got the the same error.
更奇怪的是,我从svn中取出了上次修改过的代码,但还是得到了同样的错误。
22 个解决方案
#1
26
You may be accidentally #import
'ing a .m file instead of a .h. Use Cmd+Shift+F and search for ".m" (without quotes). It will most likely lie in one of the classes mentioned in the warning. If not, clean and run again.
您可能不小心导入了.m文件而不是.h。使用Cmd+Shift+F搜索"。m”(没有引号)。它很可能位于警告中提到的其中一个类中。如果没有,清理并再次运行。
#2
20
I was also having same issue and I did following and issue is gone.
我也有同样的问题,我做了跟进,问题消失了。
Go to Product -> Clean and re-run the project.
进入产品->清洗和重新运行项目。
I hope it might be useful for some other developers.
我希望它对其他一些开发人员有用。
#3
7
After running into this problem a few minutes ago (yes, I know it's been 7 months since the original thread) I found that the root of my issue was due to me dragging & dropping files into my project within XCode instead of right-clicking and choosing Add Files to Project.
在几分钟前遇到这个问题(是的,我知道从最初的线程到现在已经有7个月了)之后,我发现问题的根源是我在XCode中拖放文件到我的项目中,而不是右键单击并选择向项目添加文件。
#4
4
Check playSiew.m is in Compile Sources section. isn't it?
检查playSiew。m在编译源代码部分。不是吗?
You can find Compile Sources section follow this step
您可以在此步骤中找到编译源部分。
- Select YourProjectName
- 选择YourProjectName
- Select TARGETS
- 选择目标
- Select Build Phases
- 选择构建阶段
If don't have playSiew.m in this section . You must to add it to this section.
如果没有playSiew。我在这部分。您必须将其添加到此部分。
#5
3
As I said the problem wasn't the code but some settings. So what I did was copying the code from my friends' Mac (it was working fine), and installed a fresh copy of the project to my Mac. It worked.
正如我所说的,问题不在于代码,而在于一些设置。所以我做的就是从我朋友的Mac上拷贝代码(它运行得很好),然后把一个新的项目拷贝到我的Mac上。
#6
3
I was importing a library in a test case which I had specified in my pod file for the main target but not for the test target.
我在测试用例中导入了一个库,我在pod文件中为主要目标而不是测试目标指定了这个库。
#7
2
I also got this error because I had accidentally included two versions of the same source file. Deleted the wrong one and the problem went away...
我还得到了这个错误,因为我意外地包含了同一个源文件的两个版本。删除了错误的那个,问题就消失了……
#8
1
Faced similar issue, while running the code on a simulator, tried all the above mentioned options, still got the same error. Tried connecting the iOS device and build the code, it worked for us. This can be a quick workaround.
面对类似的问题,在模拟器上运行代码时,尝试了上述所有选项,仍然得到相同的错误。尝试连接iOS设备并构建代码,它对我们有用。这可以是一个快速的解决方案。
#9
1
If you're working in Unity and export to iOS and you are using a plugin, go to Xcode Build Settings and set ENABLE BITCODE = NO. I'm guessing this might apply to other situations as well
如果您正在使用Unity并导出到iOS,并且正在使用一个插件,请转到Xcode构建设置并设置ENABLE BITCODE = NO。我猜这也适用于其他情况
#10
0
the same error i faced. so, i just removed reference of that classes which are generating the errors and than again gave reference and the error was gone...
我也遇到过同样的错误。因此,我删除了那些产生错误的类的引用,然后再次给出引用,错误就消失了……
as D80Buckeye says there should be problem of dragging and dropping files instead of Clicking on "Add Files"
正如D80Buckeye所说,应该存在拖放文件的问题而不是点击“添加文件”
#11
0
In case this comes in useful for anyone else--I just had this same error, and turns out the cause was initializing a variable in my header file rather than in the main file.
如果这对其他任何人都有用——我只是犯了同样的错误,结果发现原因是在我的头文件中而不是在主文件中初始化了一个变量。
#12
0
I just encountered the same error. If you are using embedded Libraries, make sure your Deployment Target is set to iOS 8.0 or higher.
我只是遇到了同样的错误。如果您正在使用嵌入式库,请确保将部署目标设置为iOS 8.0或更高。
#13
0
you only need to add the following framework: quartzcore.framework
您只需添加以下框架:quartzcore.framework
#14
0
The only way we can get past this bug on our project is to do a Clean and then build for iPad Retina. After that it will build successfully for any device. Weird.
在我们的项目中,唯一能解决这个问题的方法就是做一个干净的iPad视网膜。之后,它将成功地为任何设备构建。奇怪。
#15
0
In my case i have add reference of FacebookLoginSDK framework but forget to give search path in build setting. After removing its reference everything was fine.
在我的例子中,我添加了FacebookLoginSDK框架的引用,但是在构建设置中忘记了给出搜索路径。删除了引用之后,一切都很好。
So conclusion is if you are adding any external framework be careful.
结论是,如果你要添加任何外部框架都要小心。
#16
0
If this happens to you with CoreData generated classes, combine the +CoreDataProperties and +CoreDataClass into the +CoreDataProperties class and delete the +CoreDataClass. Make sure to search Derived Data for leftovers of the +CoreDataClass. Even after deleting the Derived Data and cleaning I sometimes had Xcode just generate the +CoreDataClass again and again. Deleting it manually in Finder and then re-bulding helped me solve this.
如果您使用CoreData生成的类,那么将+CoreDataProperties和+CoreDataClass合并到+CoreDataProperties类中,并删除+CoreDataClass。确保搜索+CoreDataClass的遗留数据。甚至在删除派生数据和清理之后,我有时也会使用Xcode来一次又一次地生成+CoreDataClass。在Finder中手动删除它,然后重新填充帮助我解决了这个问题。
#17
0
try this, go to Target -> Build Settings,then search these three as following,
试试这个,到Target ->构建设置,然后搜索这三个,如下所示,
GCC_NO_COMMON_BLOCKS,
GCC_NO_COMMON_BLOCKS,
CLANG_WARN_INFINITE_RECURSION,
CLANG_WARN_INFINITE_RECURSION,
CLANG_WARN_SUSPICIOUS_MOVE,
CLANG_WARN_SUSPICIOUS_MOVE,
set NO to each value then clean and build.
将NO设置为每个值,然后进行清理和构建。
#18
0
If you are using pods make sure that you are working in the workspace file. If not close that project and reopen it but with the workspace file. Error was fixed for me with this solution.
如果您正在使用pod,请确保您正在工作区文件中工作。如果不关闭该项目并重新打开它,则使用工作区文件。我用这个解决办法修正了错误。
#19
0
I tried several of the answers listed but none worked for me. I got the error after updating XCode (while it was still open which may have contributed to the problem)
我试了列出的几个答案,但没有一个对我有效。我在更新XCode后得到了错误(虽然它仍然是打开的,这可能导致了问题)
First, I deleted my Derived Data folder: XCode => Preferences => Locations => Double Click on arrow next to path indicating where the Derived Data folder is. Then "Move to Trash" I don't think that's what the problem was, but it's amazing how many times this has been an issue for me working on different problems.
首先,我删除了派生数据文件夹:XCode =>首选项=> location =>双击指向导出数据文件夹所在路径的箭头。然后“扔垃圾”,我不认为这是问题所在,但令人惊讶的是,有多少次我在处理不同的问题。
Second, I 'Quit' the simulator.
第二,我退出了模拟器。
Third, I 'Quit' XCode.
第三,我XCode“辞职”。
Fourth, I opened up my project in XCode again and then did a Clean and Build (found in the Product menu)
第四,我在XCode中重新打开了我的项目,然后做了一个干净的构建(在产品菜单中)
Fifth, I ran my project and it worked fine
第五,我的项目运行良好
#20
0
Cleaning the project not works for me. Restart the Xcode works for me...
清理这个项目对我没用。重新启动Xcode为我工作……
#21
#22
-2
Go to general and linked frameworks and libraries in xcode and remove all the files there.
转到xcode中的通用框架和链接库,并删除其中的所有文件。
#1
26
You may be accidentally #import
'ing a .m file instead of a .h. Use Cmd+Shift+F and search for ".m" (without quotes). It will most likely lie in one of the classes mentioned in the warning. If not, clean and run again.
您可能不小心导入了.m文件而不是.h。使用Cmd+Shift+F搜索"。m”(没有引号)。它很可能位于警告中提到的其中一个类中。如果没有,清理并再次运行。
#2
20
I was also having same issue and I did following and issue is gone.
我也有同样的问题,我做了跟进,问题消失了。
Go to Product -> Clean and re-run the project.
进入产品->清洗和重新运行项目。
I hope it might be useful for some other developers.
我希望它对其他一些开发人员有用。
#3
7
After running into this problem a few minutes ago (yes, I know it's been 7 months since the original thread) I found that the root of my issue was due to me dragging & dropping files into my project within XCode instead of right-clicking and choosing Add Files to Project.
在几分钟前遇到这个问题(是的,我知道从最初的线程到现在已经有7个月了)之后,我发现问题的根源是我在XCode中拖放文件到我的项目中,而不是右键单击并选择向项目添加文件。
#4
4
Check playSiew.m is in Compile Sources section. isn't it?
检查playSiew。m在编译源代码部分。不是吗?
You can find Compile Sources section follow this step
您可以在此步骤中找到编译源部分。
- Select YourProjectName
- 选择YourProjectName
- Select TARGETS
- 选择目标
- Select Build Phases
- 选择构建阶段
If don't have playSiew.m in this section . You must to add it to this section.
如果没有playSiew。我在这部分。您必须将其添加到此部分。
#5
3
As I said the problem wasn't the code but some settings. So what I did was copying the code from my friends' Mac (it was working fine), and installed a fresh copy of the project to my Mac. It worked.
正如我所说的,问题不在于代码,而在于一些设置。所以我做的就是从我朋友的Mac上拷贝代码(它运行得很好),然后把一个新的项目拷贝到我的Mac上。
#6
3
I was importing a library in a test case which I had specified in my pod file for the main target but not for the test target.
我在测试用例中导入了一个库,我在pod文件中为主要目标而不是测试目标指定了这个库。
#7
2
I also got this error because I had accidentally included two versions of the same source file. Deleted the wrong one and the problem went away...
我还得到了这个错误,因为我意外地包含了同一个源文件的两个版本。删除了错误的那个,问题就消失了……
#8
1
Faced similar issue, while running the code on a simulator, tried all the above mentioned options, still got the same error. Tried connecting the iOS device and build the code, it worked for us. This can be a quick workaround.
面对类似的问题,在模拟器上运行代码时,尝试了上述所有选项,仍然得到相同的错误。尝试连接iOS设备并构建代码,它对我们有用。这可以是一个快速的解决方案。
#9
1
If you're working in Unity and export to iOS and you are using a plugin, go to Xcode Build Settings and set ENABLE BITCODE = NO. I'm guessing this might apply to other situations as well
如果您正在使用Unity并导出到iOS,并且正在使用一个插件,请转到Xcode构建设置并设置ENABLE BITCODE = NO。我猜这也适用于其他情况
#10
0
the same error i faced. so, i just removed reference of that classes which are generating the errors and than again gave reference and the error was gone...
我也遇到过同样的错误。因此,我删除了那些产生错误的类的引用,然后再次给出引用,错误就消失了……
as D80Buckeye says there should be problem of dragging and dropping files instead of Clicking on "Add Files"
正如D80Buckeye所说,应该存在拖放文件的问题而不是点击“添加文件”
#11
0
In case this comes in useful for anyone else--I just had this same error, and turns out the cause was initializing a variable in my header file rather than in the main file.
如果这对其他任何人都有用——我只是犯了同样的错误,结果发现原因是在我的头文件中而不是在主文件中初始化了一个变量。
#12
0
I just encountered the same error. If you are using embedded Libraries, make sure your Deployment Target is set to iOS 8.0 or higher.
我只是遇到了同样的错误。如果您正在使用嵌入式库,请确保将部署目标设置为iOS 8.0或更高。
#13
0
you only need to add the following framework: quartzcore.framework
您只需添加以下框架:quartzcore.framework
#14
0
The only way we can get past this bug on our project is to do a Clean and then build for iPad Retina. After that it will build successfully for any device. Weird.
在我们的项目中,唯一能解决这个问题的方法就是做一个干净的iPad视网膜。之后,它将成功地为任何设备构建。奇怪。
#15
0
In my case i have add reference of FacebookLoginSDK framework but forget to give search path in build setting. After removing its reference everything was fine.
在我的例子中,我添加了FacebookLoginSDK框架的引用,但是在构建设置中忘记了给出搜索路径。删除了引用之后,一切都很好。
So conclusion is if you are adding any external framework be careful.
结论是,如果你要添加任何外部框架都要小心。
#16
0
If this happens to you with CoreData generated classes, combine the +CoreDataProperties and +CoreDataClass into the +CoreDataProperties class and delete the +CoreDataClass. Make sure to search Derived Data for leftovers of the +CoreDataClass. Even after deleting the Derived Data and cleaning I sometimes had Xcode just generate the +CoreDataClass again and again. Deleting it manually in Finder and then re-bulding helped me solve this.
如果您使用CoreData生成的类,那么将+CoreDataProperties和+CoreDataClass合并到+CoreDataProperties类中,并删除+CoreDataClass。确保搜索+CoreDataClass的遗留数据。甚至在删除派生数据和清理之后,我有时也会使用Xcode来一次又一次地生成+CoreDataClass。在Finder中手动删除它,然后重新填充帮助我解决了这个问题。
#17
0
try this, go to Target -> Build Settings,then search these three as following,
试试这个,到Target ->构建设置,然后搜索这三个,如下所示,
GCC_NO_COMMON_BLOCKS,
GCC_NO_COMMON_BLOCKS,
CLANG_WARN_INFINITE_RECURSION,
CLANG_WARN_INFINITE_RECURSION,
CLANG_WARN_SUSPICIOUS_MOVE,
CLANG_WARN_SUSPICIOUS_MOVE,
set NO to each value then clean and build.
将NO设置为每个值,然后进行清理和构建。
#18
0
If you are using pods make sure that you are working in the workspace file. If not close that project and reopen it but with the workspace file. Error was fixed for me with this solution.
如果您正在使用pod,请确保您正在工作区文件中工作。如果不关闭该项目并重新打开它,则使用工作区文件。我用这个解决办法修正了错误。
#19
0
I tried several of the answers listed but none worked for me. I got the error after updating XCode (while it was still open which may have contributed to the problem)
我试了列出的几个答案,但没有一个对我有效。我在更新XCode后得到了错误(虽然它仍然是打开的,这可能导致了问题)
First, I deleted my Derived Data folder: XCode => Preferences => Locations => Double Click on arrow next to path indicating where the Derived Data folder is. Then "Move to Trash" I don't think that's what the problem was, but it's amazing how many times this has been an issue for me working on different problems.
首先,我删除了派生数据文件夹:XCode =>首选项=> location =>双击指向导出数据文件夹所在路径的箭头。然后“扔垃圾”,我不认为这是问题所在,但令人惊讶的是,有多少次我在处理不同的问题。
Second, I 'Quit' the simulator.
第二,我退出了模拟器。
Third, I 'Quit' XCode.
第三,我XCode“辞职”。
Fourth, I opened up my project in XCode again and then did a Clean and Build (found in the Product menu)
第四,我在XCode中重新打开了我的项目,然后做了一个干净的构建(在产品菜单中)
Fifth, I ran my project and it worked fine
第五,我的项目运行良好
#20
0
Cleaning the project not works for me. Restart the Xcode works for me...
清理这个项目对我没用。重新启动Xcode为我工作……
#21
0
For me it was different. I had the same error when I removed a Pod and solved it by removing this pod from the Other Linker Flags in the Build Settings
对我来说是不同的。当我移除一个Pod并通过从构建设置中的其他链接器标记中移除该Pod来解决这个问题时,我也犯了同样的错误
then clean your project [Product > Clean] and rebuild
然后清理你的项目[产品>清洁]和重建。
#22
-2
Go to general and linked frameworks and libraries in xcode and remove all the files there.
转到xcode中的通用框架和链接库,并删除其中的所有文件。