编译c ++程序时出现致命错误

时间:2016-11-06 05:55:17

标签: c++ eclipse windows

我正在使用eclipse kepler for C ++,在编译一个简单的hello world程序时我看到了这个错误。

c:\mingw\include\_mingw.h:73:20: fatal error: w32api.h: No such file or directory

虽然整个窗户都是如此。

09:15:59 **** Incremental Build of configuration Debug for project project1 ****
Info: Internal Builder is used for build
g++ "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include\\c++" "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include\\c++\\backward" "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include" "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include-fixed" "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include\\c++\\mingw32" "-IC:\\MinGW\\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\project1.o" "..\\src\\project1.cpp" 
In file included from c:\mingw\include\wchar.h:53:0,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
                 from ..\src\project1.cpp:2:
c:\mingw\include\_mingw.h:73:20: fatal error: w32api.h: No such file or directory
compilation terminated.

09:16:01 Build Finished (took 2s.535ms)

我该怎么办? 我的代码就是这个

#include <iostream>
using namespace std;
int main()
{
     cout<<"hello world";
}

2 个答案:

答案 0 :(得分:0)

问题与MinGW安装程序有关。有一个必须安装的软件包,但它没有安装它。转到MinGW安装程序并添加ming-w32-w32.api,然后从安装菜单中应用更改。

答案 1 :(得分:0)

就我而言,我是这样解决的:

  1. 转到 MinGW 安装管理器。
  2. 从安装列表中选择“Basic Setup”并勾选包“mingw32-base-bin”。
  3. 从安装选项卡中选择“应用更改”。