在cygwin终端运行时显示不存在的文件夹
cmake error showing nonexistent folder on running in cygwin terminal
我正在尝试使用cmake在cygwin(在windows 8中)编译c++库g20。我创建了一个构建文件夹,当我尝试在该文件夹中执行cmake时,它会失败,并出现以下错误
$ cmake ../
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8.11.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp
Run Build Command:/cygdrive/c/Program
Files/MATLAB/R2009a/bin/win64/gmake.exe "cmTryCompileExec3795381385/fast"
C:/Program Files/MATLAB/R2009a/bin/win64/gmake -f
CMakeFiles/cmTryCompileExec3795381385.dir/build.make
CMakeFiles/cmTryCompileExec3795381385.dir/build
gmake[1]: Entering directory `B:/g2o/trunk/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report "/cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp/CMakeFiles" 1
Building C object
CMakeFiles/cmTryCompileExec3795381385.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTryCompileExec3795381385.dir/testCCompiler.c.o
-c "/cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp/testCCompiler.c"
Linking C executable cmTryCompileExec3795381385.exe
/usr/bin/cmake.exe -E cmake_link_script
CMakeFiles/cmTryCompileExec3795381385.dir/link.txt --verbose=1
gmake[1]: Leaving directory `B:/g2o/trunk/build/CMakeFiles/CMakeTmp'
process_begin: CreateProcess(NULL, /usr/bin/cmake.exe -E cmake_link_script
CMakeFiles/cmTryCompileExec3795381385.dir/link.txt --verbose=1, ...)
failed.
make (e=2): The system cannot find the file specified.
gmake[1]: *** [cmTryCompileExec3795381385.exe] Error 2
gmake: *** [cmTryCompileExec3795381385/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (PROJECT)
-- Configuring incomplete, errors occurred!
这里有趣的事情是我在我的机器上安装了cmake 3.0,错误显示为cmake 2.8.11.2。我在电脑里搜索了一下,找不到那个名字的文件夹。system path变量也包含正确的cmake bin文件夹的路径。
我想不出这个错误背后的原因。这是cygwin本身的问题吗?我能做些什么来避免这个错误?
需要注意的一点是,Cygwin有自己的CMake副本,即您所看到的2.8.11.2。该版本与您的Windows机器上的版本没有任何关系。您是否尝试使用Windows安装版本而不是Cygwin?
我认为问题来自没有在Cygwin中安装所有必需的编译器库。您可以尝试创建一个简单的c++文件,并尝试直接使用gcc编译它。如果失败了,你现在已经找到了CMake失败的原因。
除非有很好的理由,否则你应该考虑不要在Windows中使用Cygwin来运行CMake。
这个问题,至少对我来说,是c编译器不接受unix风格的路径。
解决方案是通过cygwin安装gcc。我安装的包应该是gcc-base
和gcc-cpp
,
相关文章:
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- "assimp/config.h"找不到,但它在文件夹中
- 当包含头文件的文件不在根项目文件夹中时,如何包含它
- CMake 生成的程序无法在 Windows 上链接:尝试链接到不存在的文件
- 如何检查特定文件夹中是否存在任何文件?
- 在不存在的目录中打开文件,C 与 C++
- Java System.loadLibrary 不会在 /usr/lib/x86_64-linux-gnu/ 文件夹中查
- 如果C 中不存在,如何创建文件夹
- ifstream::is_open 返回 true,即使该位置不存在文件也是如此
- CMake 插入不带文件夹前缀的项目文件
- 查找第一个文件/查找下一个文件不返回文件夹中的所有文件
- C 可执行文件不从文件夹工作,而是在Mac上从控制台上工作
- 打开文件对话框如何选择多个文件而不是文件夹
- 如果文件夹不存在,则创建文件夹,如果存在,则不执行任何操作
- 如何使用 NIX 标准库删除文件夹中的所有文件,但不删除文件夹
- 打开包含不存在文件的文件流后不会引发异常
- 在不存在文件损坏风险的情况下覆盖文件
- 允许 IFileOpenDialog 选取尚不存在的文件夹
- 在cygwin终端运行时显示不存在的文件夹
- C++:提升:如何检查工作目录中另一个文件夹中是否存在文件夹