安装MinCW& cygwin但无法编译任何东西

时间:2014-05-21 20:31:28

标签: c compilation mingw

每次我尝试编译一个简单的hello world程序时,我都会得到一个充满错误的控制台。我有DevC ++,当我使用IDE时它编译得很好并且工作得很好但是我开始从Notepad ++和命令行做所有事情。这是我的错误:

C:\Users\root\Desktop>g++ helloworld.c -o helloworld.exe
In file included from c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/
4.4.3/../../../../include/stdio.h:26,
                from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:20: error: expected constructor, destruc
tor, or type conversion before '_set_errno'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:21: error: expected constructor, destruc
tor, or type conversion before '_get_errno'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:26: error: expected initializer before '
__threadhandle'
In file included from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:191: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:202: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:206: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:209: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:210: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:289: error: expected constructor, destructor, or type conv
ersion before 'fread'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:290: error: expected constructor, destructor, or type conv
ersion before 'fwrite'
In file included from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:438: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:442: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:446: error: expected constructor, destructor, or type conv
ersion before 'fgetwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:447: error: expected constructor, destructor, or type conv
ersion before 'fputwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:448: error: expected constructor, destructor, or type conv
ersion before 'ungetwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:453: error: expected constructor, destructor, or type conv
ersion before 'getwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:454: error: expected constructor, destructor, or type conv
ersion before 'getwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:456: error: expected constructor, destructor, or type conv
ersion before 'putwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:458: error: expected constructor, destructor, or type conv
ersion before 'putwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:472: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:474: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:496: error: expected constructor, destructor, or type conv
ersion before '_fgetwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:497: error: expected constructor, destructor, or type conv
ersion before '_fputwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:502: error: expected constructor, destructor, or type conv
ersion before 'fgetwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:503: error: expected constructor, destructor, or type conv
ersion before 'fputwchar'

1 个答案:

答案 0 :(得分:0)

看起来好像使用了错误的库(可能文件已损坏或在编译器搜索的位置中不存在)。或者您可能没有添加所需的所有库。当我错误地输入库名时,我遇到了同样的问题。