关于#ui#的问题,如何解决?

想使用vs code进行gui的开发,使用WxWidget,教程说需要用到CMake,思路就是将WxWidget的library和头文件链接到项目中,进行到用Cmake构建的时候出现了错误:
I have a problem when using Cmake to build the binaries, the error is as followed
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Is there any fixed to this?
视频教程网站:https://youtu.be/tHMGA0jIl3Y
请教下有什么解决方案吗?

img

img

这个错误是因为CMake无法找到MinGW的编译工具链。有几个解决方法:

  1. 安装MinGW工具链。可以下载MinGW installer安装。安装后,CMake会自动找到工具链。
  2. 在CMakeLists.txt文件中手动指定工具链路径。比如:
    cmake
    set(CMAKE_C_COMPILER "D:/MinGW/bin/gcc.exe")
    set(CMAKE_CXX_COMPILER "D:/MinGW/bin/g++.exe")
    将路径替换为你的MinGW安装路径。
  3. 使用Visual Studio编译器。在CMake中选择“Visual Studio 16 2019”作为生成器,这样会使用VS 2019的编译工具链进行构建。
  4. 切换到其他编译器,比如Clang。在CMake中选择“Clang”作为C和CXX的编译器。
    除了MinGW之外,CMake支持多种编译器和生成器。你可以选择一个你安装的编译器,而不一定是MinGW。
    另外,更详细的CMake教程,可以参考官方文档:https://cmake.org/cmake/help/latest/guide/tutorial/index.html