cocos2dx 4.x iOS cmake

按照官网教程:
cmake … -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
命令后报错:
– The C compiler identification is unknown
– The CXX compiler identification is unknown
System is unknown to cmake, create:
Platform/iOS to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake@www.cmake.org.
CMake Error at CMakeLists.txt:30 (project):
No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:30 (project):
No CMAKE_CXX_COMPILER could be found.

– Configuring incomplete, errors occurred!

看起来是编辑器找不到,有没有人知道在哪里设置的?
我已经尝试了重新指定xcode和在上方命令中加入-D CMAKE_C_COMPILER的操作,均无法解决。

1赞

CMakeLists.txt里面加两句,具体哪两句我忘了,晚点儿我把工程翻出来看看

set(CMAKE_C_COMPILER “gcc”)
set(CMAKE_CXX_COMPILER “g++”)

在set(APP_NAME xxxxxx) 之前

没用呀 mac的环境

你是同样的报错吗,上面他那个报错,是The C compiler identification is unknown,The CXX compiler identification is unknown,找不到c编译器和c++编译器,cmake文件里面指定一下编译器gcc和g++应该就好了。

把 CMAKE_CXX_COMPILER 去掉试试?
一般情况下不需要指定,cmake会自动查找你已安装的编译器环境,在不同环境切换也不需要修改指定了

我强制指定绝对路径 没问题了