我正在关注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时不使用编译器列表?
它确实使用了编译器列表,如果您在套件选择中选择了正确的编译器.
解决方法
使用CMake时,为什么Qt Creator不使用编译器列表?
它确实如此,但只有在您将Kit设置为使用正确的编译器时!
为什么CMake没有在PATH中找到编译器集?
这实际上是带有CMake的Ninja Generator的问题.如果你直接使用CMake,会发生同样的事情.
为什么Qt Creator不能提供正常的“MinGW Makefiles”生成器?
它确实如此,但前提是您在套件中选择了MinGW编译器!
如何让Qt Creator通过CMake使用MinGW编译器?
通过正确设置一切,而不是过分依赖官方指南.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。