Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
来源:互联网 发布:js des加密解密插件 编辑:程序博客网 时间:2024/05/22 03:16
最近因为需要,要用C,C++,Objective-C三种C语言3C混编的开发程序,在当然方法也和大家说一下吧,就是在Xcode环境中把C语言的.c文件,C++的.cpp文件与Objective-C的.m文件的文件名全部修改成.mm,这样就可以启用Objective-C++的编译环境3C混编了,可是遇到了上述问题,网上的说法不一致,而且我也遇到了多次这个问题,最后解决的方式也不一样,所以最后把所有可能的情况总结了一下:
1)static方法名重复-因为C语言里没有对象的概念,它的方法只要加入相应的.h文件就可以使用,所以,如果和C++ or Objective-C的静态方法重名了,那么环境无法区分,很明显,这个错误是编译时候的错误,而对于static的变量及方法是在编译的时候便被加入的,所以无法识别.
2)全局变量名重复,理由和上面是一样的,当然,如果是全局变量,建议在Objective-C的.m文件(当然现在被改成.mm了)中声名,不然,声明在.h中单独使用是没有问题的,如果直接引用了C or C++的.h,那么即使这时候全局变量不重复,也会出现上面的问题.
3)含有多个main方法,main方法是程序的入口,如果有多个文件含有main方法,那么也会出现上面的问题.
总的来说,这个问题是因为方法或是全局变量重复所导致的编译环境无法识别并编译
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
- Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
- [iOS]/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1 的错误解决
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit cod
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4. failed with exit code 1
- [IOS]Command /xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with
- Command/Develeoper/Platforms/iphoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed
- [问题】Command /Developer/usr/bin/ibtool failed with exit code 255 error ?
- Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng failed with exit code 1
- Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng failed with exit code 1
- Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/
- Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/
- iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code1
- iOS运行错误:Command /Applications/Xcode 2.app/Contents/Developer/usr/bin/actool failed with exit code 25
- [iPhone]command /usr/bin/codesign failed with exit code 1
- Error:Command /usr/bin/codesign failed with exit code 1
- 求余 % 与另一种解法 时间 分析
- 祭奠、
- 一个人的战斗
- 积分又不够了……
- [解决]打开tomcat-6.0.18的startup.bat后,DOS窗口一闪就关闭了
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
- Silverlight入门学习(16)
- jquery自动切换tabs选项卡
- showModelDialog 与showModelessDialog 详解
- RT73网卡破解WIFI密码(WEP)&& secureCRT中VI编辑器显示彩色文本 && secureCRT中文显示乱码
- 很高兴加入这个集体
- 如何枚举windows系统中的所有设备
- Silverlight入门学习(17)
- 晒晒积累的点点经验--单点登录