CMake 无法使用 C++ 确定链接器语言
问题描述
我正在尝试使用 Visual Studio 2010 和 Cygwin 在 Windows 7 x64 上运行 cmake hello world 程序,但似乎两者都无法工作.我的目录结构如下:
I'm attempting to run a cmake hello world program on Windows 7 x64 with both Visual Studio 2010 and Cygwin, but can't seem to get either to work. My directory structure is as follows:
我做了一个 cd build
后跟一个 cmake ..
,然后得到一个错误说明
I do a cd build
followed by a cmake ..
, and get an error stating that
但是,如果我在我的文件系统和 src/CMakeLists.txt
中将 main.cpp 的扩展名更改为 main.c,一切都会按预期进行.这是从 Visual Studio 命令提示符(Visual Studio 解决方案生成器)和 Cygwin 终端(Unix Makefiles 生成器)运行的情况.
However, if I change the extension of main.cpp to main.c both on my filsystem and in src/CMakeLists.txt
everything works as expected. This is the case running from both the Visual Studio Command Prompt (Visual Studio Solution Generator) and the Cygwin Terminal (Unix Makefiles Generator).
知道为什么这段代码不起作用吗?
Any idea why this code wouldn't work?
CMakeLists.txt
CMakeLists.txt
src/CMakeLists.txt
src/CMakeLists.txt
src/main.cpp
src/main.cpp
推荐答案
尝试改变
进入
或者只是
参见:http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:project
这篇关于CMake 无法使用 C++ 确定链接器语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!