Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1 的错误解决
来源:互联网 发布:买淘宝店铺安全吗 编辑:程序博客网 时间:2024/06/05 07:26
最近因为需要,要用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 的错误解决
- [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
- Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 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 /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
- iOS运行错误:Command /Applications/Xcode 2.app/Contents/Developer/usr/bin/actool failed with exit code 25
- 错误:Command /usr/bin/codesign failed with exit code 1
- [问题】Command /Developer/usr/bin/ibtool failed with exit code 255 error ?
- Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/
- Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/
- 配置程序及解决Command /usr/bin/codesign failed with exit code 1错误
- iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code1
- CListCtrl多表头
- EclipseUML介绍
- 例化的方法实现多路开关量输入
- ASPxGridview使用总结(DEVExpress)
- 序列化的作用
- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1 的错误解决
- 应该这样
- Java RMI
- CListCtrl表头控制
- 可空类型的转换问题(?|nullable)
- gcc 指定运行时动态库路径
- 错误捕捉方案
- 登录远程SQL服务器
- ASP.NET自定义错误页面