17

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:

enter image description here

It says I need a Target and a Configuration, but there're none in the dropdown. Is there a configuration step I missed?

Daniel
  • 21,933
  • 14
  • 72
  • 101
hintss
  • 398
  • 1
  • 3
  • 13

3 Answers3

9

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.

Daniel
  • 21,933
  • 14
  • 72
  • 101
  • 1
    I am stuck at the exact same thing as 'hintss'. Not sure how your answer relates to the question. I do have this as the last line in the cmakelists.txt file. But still stuck because the Target and Configuration drop downs are empty. – user1198407 Jan 25 '15 at 10:52
  • Can you post your ´CMakeFiles.txt´ contents? – Daniel Jan 25 '15 at 16:35
  • cmake_minimum_required(VERSION 2.8.4) project(cpptutorialfirst) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES main.cpp) add_executable(cpptutorialfirst ${SOURCE_FILES}) – user1198407 Jan 25 '15 at 18:00
  • It seems good. Can you upload your whole project somewhere to take a look? (Dropbox?) – Daniel Jan 25 '15 at 18:53
  • I came to the same conclusion - and am a bit puzzled that GUI refers to a concept ("target") which you can only select but can't create in the gui itself, instead you have to add a magic line (magic until you learn another tool called Cmake) which doesn't seem related to the the concept (target vs executable). Not finding this too intutive to be honest. – inger Jul 17 '18 at 10:22
2

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.

MaC
  • 529
  • 7
  • 14
1

I believe, the problem is, your Compiler/Cmake environment is not set. Check File/Settings/Build, Execution, Deployment/Toolchain setup before editing the configuration.

ForceBru
  • 43,482
  • 10
  • 63
  • 98
hilo
  • 11
  • 1