在使用Cygwin的CLion中,当我尝试打开某个C++项目时,解析项目时出现以下错误CMake的文件:CLion与Cygwin:g ++。exe .../compiler-arguments.txt:没有这样的文件或目录错误
Error:Configuration emdw [Debug]
Compiler exited with error code 1: g++ -xc++ -Demdw_EXPORTS -I/cygdrive/c/Users/Dirk/.CLion2016.2/system/cmake/generated/emdw-e21eebc3/e21eebc3/Debug/src -I/cygdrive/f/devel/emdw/src -I/cygdrive/f/devel -I/cygdrive/f/devel/patrecII/src -std=c++11 -O3 -g -Wall -v -dD -E
g++.exe: error: @/cygdrive/f/users/heetbeet/AppData/Local/Temp/compiler-arguments.txt: No such file or directory
g++.exe: error: /cygdrive/f/users/heetbeet/AppData/Local/Temp/compiler-file: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
我把它克利翁生成这些类型的编译器arguments.txt /编译器文件中的文件,因为没有这样的指令在实际CMake的结构中发现。请注意,我可以在Cygwin的bash上成功运行cmake.exe
这个项目,没有任何错误。
CLion试图用compiler-arguments.txt
文件(如果它是CLion)实现什么魔法,以及如何开始调试此问题?
我可以证实,在单击在克利翁的Reload CMake Project
按钮,命名为compiler-arguments.txt
和compiler-file
在F:\users\heetbeet\AppData\Local\Temp
确实创造
两个文件(即在Cygwin中/cygdrive/f/users/heetbeet/AppData/Local/Temp/
)。
的compiler-arguments.txt
内容是:
-xc++ -Demdw_EXPORTS -I/cygdrive/c/Users/Dirk/.CLion2016.2/system/cmake/generated/emdw-e21eebc3/e21eebc3/Debug/src -I/cygdrive/f/devel/emdw/src -I/cygdrive/f/devel -I/cygdrive/f/devel/patrecII/src -std=c++11 -O3 -g -Wall -v -dD -E -D___CIDR_IGNORE_DEFINITIONS_START
的compiler-file
包含一组#if
的,#ifdef
的,第一个20线为:
#define ___CIDR_IGNORE_DEFINITIONS_END
#if !(defined (__has_extension)) && defined(__has_feature)
#define __has_extension __has_feature
#endif
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif
#ifdef __has_feature
#if __has_feature(cxx_constexpr)
____CIDR_test_query_feature->cxx_constexpr=1
#else
____CIDR_test_query_feature->cxx_constexpr=0
#endif
#if __has_feature(cxx_trailing_return)
____CIDR_test_query_feature->cxx_trailing_return=1
#else
____CIDR_test_query_feature->cxx_trailing_return=0
#endif
#if __has_feature(c_generic_selections)
____CIDR_test_query_feature->c_generic_selections=1
<...>
Thanks @uta。现在我想到了,无论是我的Cygwin还是我的“管理员”最近都在生成具有奇怪权限的文件。所以你认为这是一个文件许可问题。 –
是的,那是我的假设。 POSIX和WIN32的混合更糟糕。确保你的路径中只有一个“unix”子系统(Mingw xor cygwin xor power shell)。并且在你使用cygwin的时候改变项目的账户(或者评估的权限)。由于cygwin utils编写的文件中的“异常”ACL/DACL,导致结果不可预知。 – uta
谢谢,我搞砸了文件权限,因为我以管理员身份运行Clion(或Cygwin,不能完全记住)。不要问我为什么那么愚蠢。感谢您的老鹰眼睛发现问题,我将在未来更加严格地使用管理员身份。 –