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

今天心血来潮,根据导师的要求,开始写c语言了。本来想用vim,做java习惯了那种优雅的开发环境,比如代码补全,语法自动检查。转到vim上实在受不了,还是让vim看看Log日志吧,果断转到eclipse编译器上。

clion要钱,破解大家都会,但是要被洋鬼子发现会因为版权问题能被罚死。目前eclipse最好的道路,而且他们还在一直更新。

我使用eclipse出现这个错误,国内网站一直没有找到解决方法。

这里有个方法:https://stackoverflow.com/questions/40446450/a-fatal-error-in-compiling-a-c-program

问题描述如下

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)
解决方法是找到下图的All Packages里需要安装的插件, 然后在 installation menu中apply changes 



//再补充一点

如果使用vs code的小伙伴,在引入头文件出错

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/home/waski/myTest/myTest.cpp) will be provided by the Tag Parser. cannot open source file "stddef.h" (dependency of "iostream")

c_cpp_properties.json中"includePath": [] 的已经修改了路径,但还是报原来的错误。不妨使用上面的方法试试。


自己的水平原因可能存在错误和想给意见的,email: [email protected]



猜你喜欢

转载自blog.csdn.net/Hello_Ray/article/details/80945303