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

; color:rgb(54,46,43); font-family:Arial,Console,Verdana,‘Courier New‘">

像这样的一大堆,总体说编译链接时错误

/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders normal i386

cd /Users/zhangtianjian/Desktop/SVN

setenv IPHONEOS_DEPLOYMENT_TARGET 6.1

setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator
-L/Users/zhangtianjian/Desktop/SVN/ZBarSDK -F/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator -filelist /Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/ClothingOrders.LinkFileList
-Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -lz -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework CoreData -liconv -framework QuartzCore -framework
CoreVideo -framework CoreMedia -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lzbar -o /Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders

duplicate symbol _OBJC_METACLASS_$_EntityOrdersTotal in:

/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o

duplicate symbol _OBJC_CLASS_$_EntityOrdersTotal in:

/Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o

ld: 2 duplicate symbols for architecture i386

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

ios开发这个错误一定少不了,现总结如下,一般这三方面的问题,如果不是哪你真可麻烦了

1.引用出错,把***.h弄成了.m,检查一下你的所有引用;

2.再就是你引用第三方的库,你添加文件是系统没有所第三方库的.m文件参入的编译中去,你向项目添加文件得注意了;

3.就是不小心添加的重复的类,向Entity之类,具体你可以看这里http://stackoverflow.com/questions/2264455/iphone-duplicate-symbol-error

顺便说一下http://stackoverflow.com/这个网站是iso开发不可少的一个网站;

4.有些frameworks没有添加进来也会出现上面的问题;

如果是新添加的第三方库,且不是静态库

先重复第一步过程,然后找到 Build settings->Linking->Other Linker Flags

将此属性修改成-all_load  或者 -ObjC ,这个视情况而定。总之可以多试几次。

3.如果添加的是第三方静态库(.a文件)

[html] view
plain
copy

  1. Undefined symbols for architecture armv7:
  2. "_OBJC_CLASS_$_BaiduMobStat", referenced from:
  3. objc-class-ref in BaiduMobStatAppDelegate.o
  4. objc-class-ref in MyPageLogViewController.o
  5. (maybe you meant: _OBJC_CLASS_$_BaiduMobStatAppDelegate)
  6. ld: symbol(s) not found for architecture armv7
  7. clang: error: linker command failed with exit code 1 (use -v to see invocation)

在用到这个库的所有文件中都出现了错误, 如上 BaiduMobStatAppDelegate 类和 MyPageLogViewController类

这种情况就可能是这个静态库路径混乱导致的链接错误

解决方法:Build settings->Search Path->Library Search Paths  添加静态库的相应路径。如下图

如果上面的所有方法都不管用。你可以再试试一下几个方法:

1,看看是不是有新添加的文件跟之前文件同名

2,错误信息中出现了某个类的名字,去原文件中看看#import了哪些第三方库,把这些库挨个注释排除,找到出错的那个库,然后按照官方提供的步骤重新添加一遍。

报这样的错误可能是同一个.m文件同时存在,要先把你新添加的.m文件彻底删除 Move to Trash 点击这个删除。然后clear一下,再在重新添加你所需要的文件即可解决。这次添加不要推进来,需要在你本地文件哪里进行添加,进行拷贝添加。不然可能还会冲突。

时间: 2024-12-10 09:42:26

error: linker command failed with exit code 1 (use -v to see invocation)的相关文章

使用SVN clang: error: linker command failed with exit code 1 (use -v to see invocation)

再把项目上传到SVN仓库上,然后再拉到本地编译时出现如下错误 ld: library not found for -lxxxxxxxxxxxx clang: error: linker command failed with exit code 1 (use -v to see invocation) 原因: SVN在上传资源服务器时默认配置会把一些第三方的.a库文件等给忽略了,然后就造成这样的错误. 解决办法: 配置global-ignores文件 因为我用的是Cornerstone图像工具,

(转) error: linker command failed with exit code 1 (use -v to see invocation)

转自:http://blog.csdn.net/tiantian1980/article/details/9175777 像这样的一大堆,总体说编译链接时错误 /Users/zhangtianjian/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrder

Error:linker command failed with exit code 1 (use -v to see invocation) - iOS

今天在操作 CoreData 时,创建完 Create NSManagedObject Subclass...  后,工程中会自动生成四个文件,如下图所示: 此时此刻便以工程,激动人心的时刻来临了!莫名其妙的就抛出了一个异常(linker command failed with exit code 1 (use -v to see invocation)),如下图所示: 解决办法: 起初以为是文件重复导致的,但是距本次抛出异常操作前,只针对 CoreData 进行了操作后来经过仔细排查,所以还是

xcode上编译c语言程序报错:ld: x duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

在网上查了一下: duplicate symbol的大概意思是,编译器认为你重复定义了一些东西. linker command failed with exit code 1,则可能是项目引入了多个相同的文件. 结合本人开发中发现此类的问题,解决办法如下: 方法1:查看有问题的文件是否有重复引用.或头文件是否加载了.m 方法2:将有问题的文件删除,重新加载进去.然后:clean->build. 在开发中解决RegexKitlLite的类似问题办法: _rkl_NSExceptionForRege

nodejs错误:ld: library not found for -lgcc_s.10.5 clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案: $ cd /usr/local/lib $ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib 参考链接

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

报错提示: ... ld: 6 duplicate symbols for architecture x86_64 自己错的原因: 在 .m文件中引入了其他 .m 文件,改成引入 .h 文件即可

Xcode真机报错clang: error: linker command failed with exit code 1 (use -v to see invocation)

出现这种错误,如下图所示,搜索bitcode,置为NO即可.

ld: library not found for -lPods clang: error: linker command failed with exit code 1 (use -v to see invocation)

当用第三方库管理工具遇到这样的bug时,请确保Set Build Active Architectures Only在cocoapods和项目中设置为一样的. Had this problem as well. Something was wrong with my CocoaPods installation; No pods other than KIF were installing properly. I followed the comments on this thread to b

IOS Bugs5 linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/Products/Debug/OC_Language normal x86_64 cd /Users/Rubert/IOS/iworkspace/OC_Language export MACOSX_DEPLOYMENT_TARGET=10.10 /Applications/Xcode-beta.ap