ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Cmake构建编译报错查询

2022-08-29 18:00:30  阅读:200  来源: 互联网

标签:xcodebuild Cmake -- xcode 编译 报错 flags Xcode select


1 在MAC环境构建Xcode工程:

cmake -B build ****  -G Xcode

2报错

   CMake Error at CMakeLists.txt:2 (project):

   No CMAKE_CXX_COMPILER could be found.

3查看错误日志

在第2步报错后,我们先去找Cmake的错误日志:一般在CmakeFiles文件夹下会有这个文件:CMakeError.log

打开看看:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:  
Build flags: 
Id flags:  

The output was:
1
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:  
Build flags: 
Id flags:  

The output was:
1
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:  
Build flags: 
Id flags:  

The output was:
1
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

检查下命令行工具是否有安装:

 

xcode-select --install 
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

 

 百度一下:

https://www.cnblogs.com/huangfuql1314/p/8417597.html

 

 

 

 

终端输入:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

之后在去上边第一步操作构建的目录下执行构建命令:

 cmake -B build **【自定义】*  -G Xcode

好了。。。。。。

切换xcode命令行版本

sudo xcode-select --switch /指定版本的xcode路径Xcode.app 



恢复默认的xcode命令行版本 当使用xcodebuild莫名其妙的出问题时,可以考虑使用此命令恢复 sudo xcode-select -r

使用对话框安装命令行工具

sudo xcode-select --install
————————————————

原文链接:https://blog.csdn.net/holdsky/article/details/103066213

 

   

标签:xcodebuild,Cmake,--,xcode,编译,报错,flags,Xcode,select
来源: https://www.cnblogs.com/8335IT/p/16636818.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有