I'm trying to set up CLion (windows 8.1, 64-bit, using cygwin and not mingw), and I'm trying to compile+run a project, but I don't know what to do here:
It says I need a Target and a Configuration, but there're none in the dropdown. Is there a configuration step I missed?
Environment variables You can pass additional environment variables to CMake generation and build via the Environment field of the CMake Settings dialog (navigate to Settings / Preferences | Build, Execution, Deployment | CMake). or pressing Shift+Enter , and set the Include system environment variables checkbox.
Create a new projectIf no project is currently opened in CLion, click New Project on the Welcome screen. Otherwise, select File | New Project on the main menu. In the New Project dialog that opens, select the target type of your project (executable or library), and the language to be used (pure C or C++).
From the main menu, select Run | Edit Configurations or choose Edit Configurations from the run/debug configurations selector on the toolbar. In the Run/Debug Configurations dialog, select a configuration where you want to add the environment variables.
A build target is a string that identifies a build rule in your project. Build targets are used as arguments to Buck commands, such as buck build and buck run . Build targets are also used as arguments to build rules to enable one build rule to reference another.
At the end of your CMakeLists.txt
you should have a line that reads:
add_executable(MyTarget ${SOURCE_FILES})
This line specifies the name of your target (the executable is generated with this name).
If you don't have this line, add it and click on the "Reload changes" link at the top. This line should have been created when CLion created your project.
Check in CMakeLists.txt
that the line set(SOURCE_FILES main.cpp ...
does not reference files that does not exist. It solved it for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With