Novice step on the pit : New contact CLion Encountered a problem when creating a project with a small partner of CMake project is not loaded Error tips for , How to solve it ?

<> one ,MinGw Installation directory and environment variable configuration

first , We need to make sure that MinGW The installation path of does not contain Chinese , It is recommended to put it directly in the D:\mingw64
such D The root directory of the disk , Not added to the environment variable , It needs to be added in the system advanced settings path.


The blogger installed it alone here CMake, It's completely installed MinGW Does not need to be installed again . remember CMake The installation path of cannot contain Chinese , When installing, you can check add to Path You don't need to add it manually .

<> two , see CLion Is the compiler configured correctly

Choose the right one MinGW position ,CLion The absolute paths of other tools are automatically filled in , After success, it will be checked .

<> three , Project creation path problem

It's important. Ow , The absolute path of project creation cannot contain Chinese , Wood has a way ,MinGW And CMake Chinese path is not supported , Chinese garbled code cannot be recognized ,CMake It cannot be configured . If it's inconvenient , You can create a desktop shortcut to a folder .

<> four , Open someone else's project, this error prompt appears

There is such a problem , Suggest Xiaobai to rebuild a project , Copy the original project code directly , Because rebuilding the project will automatically configure it CMake, This is the easiest way .

<> five ,CMakeLists.txt to configure

This is generally automatic configuration , You can check if it is correct and configure it manually
# Declaration required cmake Minimum version cmake_minimum_required(VERSION 3.15) # Make a statement cmake engineering project(
study) # C++ compiler set(CMAKE_CXX_STANDARD 14) # Executable file generation add_executable(study main.
cpp)
<> six , Newly established C/C++ Is the file declared to CMakeLists

<> seven , other

Bloggers want to use CLion Because UI good-looking , But when you configure it, it's very troublesome , Step on a lot of holes , And there can't be any Chinese path yet , You need to output Chinese in the learning process , It needs to be changed utf-8 Coding and GBK code , It's a lot of trouble . If not professionals , I suggest you use it CodeBlocks, lately CodeBlocks Update to 20.03, Holistic UI The design is also very beautiful , And it doesn't need too much configuration , The error prompt is clear at a glance .

Technology