2017-08-15 2045 views
0

我最近安装了Clion学生版,每当我尝试运行我的代码时,都会收到错误可执行文件。 我按照他们的网站上的规定安装了cygwin,并根据需要安装了相应的软件包。这里是我的工具链窗口的外观Cygwin is installed and works properlyClion错误:未指定可执行文件

这里是我的CMakeLists.txt文件

cmake_minimum_required(VERSION 3.8) 
project(coding) 

set(CMAKE_CXX_STANDARD 11) 

set(SOURCE_FILES library.cpp library.h) 
add_library(coding ${SOURCE_FILES}) 

以下是错误,我得到: Executable not specified

我没有看到在可执行文件列表中的任何选项。我正在使用Windows 10.

我该怎么办?

+0

您的CMake项目只构建一个库,它不能按定义运行。那么,您希望CLion在“跑步”上做什么? – Tsyvarev

+0

我只是想运行hello world程序。所有这些文件都是自动生成的。 – krishna

回答

0

结账this answer

SHORT ANSWER (should be similar for MinGW too but I haven't tried it):

  1. Install Cygwin with GCC, G++, GDB and CMake (the required versions)
  2. Add full path to Cygwin 'bin' directory to Windows Environment variables
  3. Restart CLion and check 'Settings' -> 'Build, Execution, Deployment' to make sure CLion has picked up the right versions of Cygwin, make and gdb
  4. Check the project configuration ('Run' -> 'Edit configuration') to make sure your project name appears there and you can select options in 'Target', 'Configuration' and 'Executable' fields.
  5. Build and then Run
  6. Enjoy

编辑:

的截图仔细看,它看起来像你实际上是在做一个C++库在这种情况下,你不会有一个可执行文件,它不能运行 - 库是编译并在另一个应用程序中使用。

+0

步骤4是问题所在。我在可执行字段中看不到任何选项 – krishna

+0

@krishna我认为我在编辑中更好地回答了您的问题,Tsyvarez在您的问题上也指出了这一点 –

+0

但我并不想制作图书馆。我正在尝试运行hello world程序。 – krishna

相关问题