CLION CAN NOT BUİLD AND GIVE ME AN ERROR
Answered
Hello Im Osman
I am a student and learning C ++ so I downloaded Clion but it doesn't work please help me. What can I do
Please sign in to leave a comment.
Each `main()` function should belong to a separate executable (in other words, each executable should have only one `main()` function). In order to have several executables in your project, you need to create several CMake targets for them: there should be a `add_executable(<target name> <file name>)` line for each file in the CMakeLists.txt.
For example, if you have two files `main.cpp` and `main2.cpp` and you have a `main()` function in each of these files, the simplest CMakeLists.txt for such project should look similar to the following:
After that, you can choose which target to run (`my_project` or `my_project_2`) via "Run configuration" pop-up (left to the "Run" button).
Please read our quick CMake tutorial for more details: https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html.