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來開啟,只需要攺變這個路徑即可。