大佬教程收集整理的这篇文章主要介绍了windows – Qt Creator使用MinGW编译器和CMake,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在关注official guide,但它根本不起作用.这是我的步骤:
>将我的MinGW bin目录添加到PATH.
>运行QtCreator并设置CMake.
>打开一个非常基本的CMakeLists.txt文件.
>选择“Ninja(桌面)”作为CMake生成器.
>从CMake获取错误.
你可能已经注意到官方指南中根本没有提到第4步.我已经习惯了CMake,因此我问自己:
为什么Qt Creator不能提供正常的“MInGW Makefiles”生成器?
最后是最终的问题:
如何让Qt Creator通过CMake使用MinGW编译器?
回答的问题:
根据官方指南,正常情况下,正确设置PATH时,不应该执行步骤5.
为什么CMake没有在PATH中找到编译器集?
Ninja Generator会产生这些错误,如果你用CMake手动完成同样的事情就会发生.
CMake Error: Error required internal CMake variable not set,cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set,cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER CMake Error: Could not find cmake module file: D:/ProgrAMMing/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCXXCompiler.cmake CMake Error at CMakeLists.txt:1 (project): No CMAKE_C_COMPILER Could be found. Tell CMake where to find the compiler by setTing the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler,or to the compiler name if it is in the PATH. CMake Error at CMakeLists.txt:1 (project): No CMAKE_CXX_COMPILER Could be found. Tell CMake where to find the compiler by setTing the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler,or to the compiler name if it is in the PATH. CMake Error: Error required internal CMake variable not set,cmake may be not be built correctly. Missing variable is: CMAKE_C_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set,cmake may be not be built correctly. Missing variable is: CMAKE_C_COMPILER CMake Error: Could not find cmake module file: D:/ProgrAMMing/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCCompiler.cmake CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to SELEct a different build tool.-- Configuring incomplete,errors occurred!
查看配置菜单以查看我是否忘记设置某些内容,我偶然发现了编译器设置页面.我当然也在那里添加了我的编译器,但它没有做任何事情.
为什么CMake在使用CMake时不使用编译器列表?
它确实使用了编译器列表,如果您在套件选择中选择了正确的编译器.
以上是大佬教程为你收集整理的windows – Qt Creator使用MinGW编译器和CMake全部内容,希望文章能够帮你解决windows – Qt Creator使用MinGW编译器和CMake所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。