【发布时间】:2016-07-25 02:32:59
【问题描述】:
我刚刚下载了 CLion 和 minGW,并创建了一个项目。经过一番折腾后,我设法获得了运行示例 Hello World 程序的按钮。但是,当我尝试运行该程序时,它说它编译到 50%,然后才给我这个错误日志:https://justpaste.it/wm14
它非常长,大约 450 行。而且我不知道为什么会出现此错误...任何帮助将不胜感激! :)
错误的前几行如下。在以In file included from 开头的错误列表中存在与此类似的重复模式,后跟错误列表,例如has not been declared using 或is not a member of 'std' 或does not name a type:
In file included from c:\mingw\include\wchar.h:208:0,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
from C:\Users\Ole\Documents\programming\c++\testing\main.cpp:1:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
代码如下:
#include "iostream"
int main () {
std::cout << "Hello World!" << std::endl;
return 0;
}
我已设法将问题隔离到包含语句。如果我删除包含(和 cout),它构建得很好,但如果我添加包含(而不是 cout),它会给我同样的错误。
更新
我设法通过简单地删除 minGW 并安装 cygwin 来解决这个问题。
【问题讨论】:
-
请将您的代码添加到您的问题中。
-
我现在已经添加了代码。
-
看看如果将
include指令中的引号改为尖括号会发生什么。 Difference between angle bracket < > and double quotes “ ” while including header files in C++? 和 What is the difference between #include <filename> and #include “filename”? 我怀疑可能存在包含搜索路径问题。 -
@InzaneNova,你做了什么改变让它工作?
-
您的错误日志在我的代理服务器上被阻止。这就是为什么您应该在问题中包含所有相关信息,并且只提供作为外部链接的奖励信息