2

I am using CLion code editor. I have such structure of project:

enter image description here

This is the content of CMakeLists.txt:

cmake_minimum_required(VERSION 3.4)
project(FirstAgent)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.c)
add_executable(FirstAgent ${SOURCE_FILES})
target_link_libraries(FirstAgent simgrid)

But when I run my program in the code editor the error occur:

/usr/bin/ld: cannot open output file FirstAgent: Is a directory
collect2: error: ld returned 1 exit status
make[3]: *** [FirstAgent] Error 1
make[2]: *** [CMakeFiles/FirstAgent.dir/all] Error 2
make[1]: *** [CMakeFiles/FirstAgent.dir/rule] Error 2
make: *** [FirstAgent] Error 2

How can I avoid it?

1 Answer 1

4

You can try setting an output directory, so that the binaries are stored elsewhere:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.