Setting build target in CLion

自古美人都是妖i 提交于 2019-12-21 07:01:04

问题


I'm trying to set up CLion (windows 8.1, 64-bit, using cygwin and not mingw), and I'm trying to compile+run a project, but I don't know what to do here:

It says I need a Target and a Configuration, but there're none in the dropdown. Is there a configuration step I missed?


回答1:


At the end of your CMakeLists.txt you should have a line that reads:

add_executable(MyTarget ${SOURCE_FILES})

This line specifies the name of your target (the executable is generated with this name).

If you don't have this line, add it and click on the "Reload changes" link at the top. This line should have been created when CLion created your project.




回答2:


Check in CMakeLists.txt that the line set(SOURCE_FILES main.cpp ... does not reference files that does not exist. It solved it for me.




回答3:


I believe, the problem is, your Compiler/Cmake environment is not set. Check File/Settings/Build, Execution, Deployment/Toolchain setup before editing the configuration.



来源:https://stackoverflow.com/questions/27801836/setting-build-target-in-clion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!