Xcode4编译过程中一些常见错误

今天在Xcode4开发编译的时候遇到一些错误,上网一查看到有好多人都遇到相同的错误,所以拿出来分享下:

错误1:

 ignoring file /Users/hongyufang/SVNDemo/SVNDemo/Libs/libopenssl.a, file was built for archive which is not the architecture being linked (x86_64): /Users/hongyufang/SVNDemo/SVNDemo/Libs/libopenssl.a

 

这说明你这个工程链接静态库libopenssl.a的时候,工程的Architectures设置不对,可在Build Settings -> Architectures  设置为Standard(32/64 -bit Intel)。

 

错误2:


duplicate symbol _main in:
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-8CDEF0688F8FF878.o
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-CA858FE46BE3346A.o
duplicate symbol _main in:
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-8CDEF0688F8FF878.o
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-E9176508EEFC0477.o
duplicate symbol _main in:
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-8CDEF0688F8FF878.o
    /Users/hongyufang/Library/Developer/Xcode/DerivedData/SVNDemo-czyknsriatcctnhcmkteuhbmejfv/Build/Intermediates/SVNDemo.build/Debug/SVNDemo.build/Objects-normal/i386/main-5AE1FBC181031568.o
ld: 3 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这个说明你这个工程里面有3个相同的函数名main

 

错误3:

NSString *svnhelperPath = [bundle pathForResource:@"svnhelper" ofType:nil];

 

这个svnhelperPath 一直为nil,上网查了一下,有这么几种原因:

      1.你在创建targets的时候,创建了Command Line Tool类型,那么对不起[NSBund  pathForResource:]取不出来的。

      但是我一定要用Command Line Tool类型呢,也不是没有办法,你可以在选中你的主工程targets(Application)类型 ->Build Phases -> Cope Bundle Resources

     点击 +   把你需要的targets加进来,就ok了。

     2.你在创建targets的时候,直接创建Application类型,ok。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值