When compiling in clion, I get the error "no executable file specified"

I use MacOS and try to write C ++ code in Clion, but when I run simple hello world code, I get an executable is not specified error. I am new to Clion.

Cmakelist.txt

 cmake_minimum_required(VERSION 3.2) project(untitled) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES main.cpp) add_executable(untitled ${SOURCE_FILES}) 

clion

+8
c ++ clion
source share
3 answers

You just need to select target only for your application (select your application name).

Like this enter image description here

+2
source share

I think CLion needs CMakeLists.txt to configure startup / debugging. Additional information: https://www.jetbrains.com/clion/help/cmakelists-file.html

As a newbie in C ++, I basically created a new project in CLion, and then copied / went through the contents of CMakeLists.txt into my project by editing the necessary fields.

After that, I was able to configure my project to run / debug.

The default contents of CMakeLists.txt should look something like this:

 cmake_minimum_required(VERSION 3.3) project(YourProjectName) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES YourSourceFile.cpp) add_executable(YourProjectName ${SOURCE_FILES}) 

Hope this helps.

+1
source share

image of what to click

press the left "+" button, select "generate coffee"

-one
source share

All Articles