XCode 混編的 mac 的 app 編譯時(shí)出現(xiàn)了 'string' file not found 這個(gè)問題镰吆。
原因:string 是 stl 的頭文件,編譯時(shí)未找到該文件凭涂。
解決辦法:Build Settings -> Language -> Compile Sources As 設(shè)為根據(jù)文件類型編譯
select project -> build setting -> apple LLVM compiler 5.1 -> language -> In Compile Sources As change to Objective-C++
在工程中找到 #include <string> 的文件,確認(rèn)這些文件以及引用這些文件的文件,是 ".mm" or ".h"辟拷。是 ".m" 的話,會(huì)默認(rèn)以 OC 編譯阐斜,不會(huì)混編衫冻,所以不會(huì)默認(rèn)引入 stl 的內(nèi)容。