Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I install the CLion on a Ubuntu 14.04. I build my first project with help CMakeLists.txt:

Source file:

#include <iostream>
using namespace std;

int main() {
  cout << "Hello, World!" << endl;
  return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.4)
project(sh)

set(SOURCE_FILES main.cpp)
add_executable(sh ${SOURCE_FILES})

My source file is located in a /home/user/Desktop/sh. But after build, I don't see any executable file in this folder. Where is it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
586 views
Welcome To Ask or Share your Answers For Others

1 Answer

When you build under CLion,

enter image description here

It prints the path it sends the executable to the Console:

-- Build files have been written to: /home/<user>/.clion10/system/cmake/generated/8bd932b1/8bd932b1/Debug1

To change this File > Settings..., and under CMake settings, enter the desired subdirectory name (e.g., 'bin') in the Working directory field:

enter image description here

(You may require Run > Clean before the new output path is used.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...