iOS编译错误

来源:互联网 发布:淘宝登录界面无法打开 编辑:程序博客网 时间:2024/05/20 18:55

1. Unknown type name 'class'; did you mean 'Class'?

   引用C++ 或C代码那个类,改为.mm即可.

2.

Undefined symbols for architecture armv7s ?

 制作静态库的时候,用真机,将Build Settings下面的

    1).  Architetures 改为armv6 armv7,

    2). Build Active Architecture Olny; Debug-->YES; Release->YES.

    3)  在引用制作的静态库的工程.也要改为 Architetures 改为armv6 armv7即可.


     (相当于,暂不考虑armv7s,iphone 5 兼容armv6和armv7;但有好的解决办法,烦请告知! )


(注:

ONLY_ACTIVE_ARCH (Build Active Architecture Only)    

----------------------------------------------------------------------------------------------------

|Description:     | Boolean value. Specifies whether the product includes only

                           object code for the nativearchitecture. 

----------------------------------------------------------------------------------------------------

|Values:            | YES:The product includes only code for the native architecture("NATIVE_ARCH" ). 

             NO:The product includes code for the architectures specified in"ARCHS(Architectures)".

-----------------------------------------------------------------------------------------------------

|Default value:  |  NO

------------------------------------------------------------------------------------------------------

)

3.混编调用C代码时.m编译通过,但.mm和cpp文件中编译不通过?

 一般在调用C代码的类中,把引用C头文件发到 extern "C" {} 中.

例如:  

extern "C"{

    #include "config.h"

    #include <math.h>

    #include <limits.h>    

}

(可参见:http://en.wikipedia.org/wiki/Name_mangling)


4. Run /usr/bin/xcode-select to update the developer directory path

在terminal里面执行xed xxx.xcodeproj报错,No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.

产生此问题的原因:xcode不是默认安装的,或者不是完全默认安装,或者安装了多个xcode,系统本身并不知道要使用那一个xcode来打开这个工程

解决办法:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer,在terminal中输入这个命令即可,这表示选中这个程序来打开,如果你要使的别的地方折app来打开,只需要攺变这个路径即可。






原创粉丝点击