Clion错误:未指定可执行文件
问题描述:
我最近安装了Clion学生版,每当我尝试运行我的代码时,都会收到错误可执行文件。 我按照他们的网站上的规定安装了cygwin,并根据需要安装了相应的软件包。这里是我的工具链窗口的外观Clion错误:未指定可执行文件
这里是我的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})
我没有看到在可执行文件列表中的任何选项。我正在使用Windows 10.
我该怎么办?
答
结账this answer。
SHORT ANSWER (should be similar for MinGW too but I haven't tried it):
- Install Cygwin with GCC, G++, GDB and CMake (the required versions)
- Add full path to Cygwin 'bin' directory to Windows Environment variables
- Restart CLion and check 'Settings' -> 'Build, Execution, Deployment' to make sure CLion has picked up the right versions of Cygwin, make and gdb
- 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.
- Build and then Run
- Enjoy
编辑:
的截图仔细看,它看起来像你实际上是在做一个C++库在这种情况下,你不会有一个可执行文件,它不能运行 - 库是编译并在另一个应用程序中使用。
您的CMake项目只构建一个库,它不能按定义运行。那么,您希望CLion在“跑步”上做什么? – Tsyvarev
我只是想运行hello world程序。所有这些文件都是自动生成的。 – krishna