Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
来源:互联网 发布:减肥运动软件 编辑:程序博客网 时间:2024/06/07 01:19
原文地址::http://blog.csdn.net/dream_it_life/article/details/5488121
最近因为需要,要用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
- iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code1
- [问题】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
- [iPhone]command /usr/bin/codesign failed with exit code 1
- Error:Command /usr/bin/codesign failed with exit code 1
- xcode6 Command /usr/bin/codesign failed with exit code 1
- Command /usr/bin/codesign failed with exit code 1
- Command /usr/bin/codesign failed with exit code 1
- struts 2 传入一组数目不确定的字符串
- 淘宝技术发展(Oracle/支付宝/旺旺)之三
- Direct show: unresolved external symbol _CLSID_SampleGrabber
- Asp.net web Api源码分析-HttpRequestMessage的创建
- java中的各种数据类型在内存中存储的方式
- Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1问题总结及解决方案
- 淘宝技术发展(Java时代:脱胎换骨)之四
- 14周项目4:数组排序(冒泡法)
- 淘宝技术发展(Java时代:坚若磐石)之五
- 写JAVA代码的思考(小鸟变形记1)
- java中的instanceof关键字
- eclipse修改主题
- [Leetcode] Distinct Subsequences *
- 从EMD走进生物启发运动视觉感知