2016-11-07 56 views
0

在使用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.txtcompiler-fileF:\users\heetbeet\AppData\Local\Temp确实创造

enter image description here

两个文件(即在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 
<...> 

回答

1

我们需要创建AST你的源文件不知何故。为了使它正确,我们需要编译器特定的宏和特性FOR EACH c/cpp-file在您的项目中,因为您可以更改每个编译器选项。所以这就是您在跨平台项目中为正确突出显示和宏观评估付出的代价。

关于这个问题:你正在使用cygwin,我感觉问题可以通过chmod 777调用来解决。

+0

Thanks @uta。现在我想到了,无论是我的Cygwin还是我的“管理员”最近都在生成具有奇怪权限的文件。所以你认为这是一个文件许可问题。 –

+0

是的,那是我的假设。 POSIX和WIN32的混合更糟糕。确保你的路径中只有一个“unix”子系统(Mingw xor cygwin xor power shell)。并且在你使用cygwin的时候改变项目的账户(或者评估的权限)。由于cygwin utils编写的文件中的“异常”ACL/DACL,导致结果不可预知。 – uta

+0

谢谢,我搞砸了文件权限,因为我以管理员身份运行Clion(或Cygwin,不能完全记住)。不要问我为什么那么愚蠢。感谢您的老鹰眼睛发现问题,我将在未来更加严格地使用管理员身份。 –

相关问题