编译一个最简单的Hello World都出错,代码如下:
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!"<<endl;
system ("pause");
return 0;
}
编译错误的信息如下:
编译项目变更...
--------
- 项目文件名: N:\MyWorks\DevC++\HelloWorld.dev
- 编译器名: TDM-GCC 4.9.2 32-bit Debug
生成 makefile...
--------
- 文件名: N:\MyWorks\DevC++\Makefile.win
正在处理makefile...
--------
- makefile处理器: G:\Dev-Cpp\MinGW64\bin\mingw32-make.exe
- 命令: mingw32-make.exe -f "N:\MyWorks\DevC++\Makefile.win" all
g++.exe -D__DEBUG__ -c main.cpp -o main.o -I"G:/Dev-Cpp/MinGW64/include" -I"G:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"G:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"G:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -m32 -g3
In file included from g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stddef.h:7:0,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/stddef.h:1,
from G:\Ubuntu\MinGW\include/wchar.h:26,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:44,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/postypes.h:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iosfwd:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ios:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ostream:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iostream:39,
from main.cpp:1:
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/crtdefs.h:26:9: error: 'size_t' does not name a type
typedef size_t rsize_t;
^
In file included from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/stddef.h:1:0,
from G:\Ubuntu\MinGW\include/wchar.h:26,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:44,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/postypes.h:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iosfwd:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ios:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ostream:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iostream:39,
from main.cpp:1:
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stddef.h:20:3: error: 'errno_t' does not name a type
errno_t __cdecl _set_errno(int _Value);
^
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stddef.h:21:3: error: 'errno_t' does not name a type
errno_t __cdecl _get_errno(int *_Value);
^
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stddef.h:26:18: error: 'uintptr_t' does not name a type
_CRTIMP extern uintptr_t __cdecl __threadhandle(void);
^
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stddef.h:218:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __SIZE_TYPE__ size_t;
^
In file included from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:44:0,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/postypes.h:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iosfwd:40,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ios:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ostream:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iostream:39,
from main.cpp:1:
G:\Ubuntu\MinGW\include/wchar.h:105:59: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
^
G:\Ubuntu\MinGW\include/wchar.h:108:60: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
^
G:\Ubuntu\MinGW\include/wchar.h:146:52: error: 'size_t' has not been declared
int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
^
G:\Ubuntu\MinGW\include/wchar.h:148:25: error: 'size_t' has not been declared
vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
^
G:\Ubuntu\MinGW\include/wchar.h:175:80: error: 'size_t' has not been declared
_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:193:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
^
G:\Ubuntu\MinGW\include/wchar.h:210:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*);
^
G:\Ubuntu\MinGW\include/wchar.h:212:77: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:213:76: error: 'size_t' has not been declared
_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:219:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:233:80: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
G:\Ubuntu\MinGW\include/wchar.h:304:67: error: 'size_t' has not been declared
wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:305:46: error: 'size_t' has not been declared
int wmemcmp(const wchar_t*, const wchar_t *, size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:308:5: error: 'size_t' has not been declared
size_t);
^
G:\Ubuntu\MinGW\include/wchar.h:309:73: error: 'size_t' has not been declared
wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t);
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:151:11: error: '::mbrlen' has not been declared
using ::mbrlen;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:152:11: error: '::mbrtowc' has not been declared
using ::mbrtowc;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:154:11: error: '::mbsrtowcs' has not been declared
using ::mbsrtowcs;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:176:11: error: '::wcrtomb' has not been declared
using ::wcrtomb;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:181:11: error: '::wcscspn' has not been declared
using ::wcscspn;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:182:11: error: '::wcsftime' has not been declared
using ::wcsftime;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:183:11: error: '::wcslen' has not been declared
using ::wcslen;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:187:11: error: '::wcsrtombs' has not been declared
using ::wcsrtombs;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:188:11: error: '::wcsspn' has not been declared
using ::wcsspn;
^
g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cwchar:196:11: error: '::wcsxfrm' has not been declared
using ::wcsxfrm;
^
In file included from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/x86_64-w64-mingw32/32/bits/gthr-default.h:34:0,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/x86_64-w64-mingw32/32/bits/gthr.h:148,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ext/atomicity.h:35,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/bits/ios_base.h:39,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ios:42,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/ostream:38,
from g:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/iostream:39,
from main.cpp:1:
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/pthread.h:364:74: error: 'size_t' has not been declared
int WINPTHREAD_API pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size);
^
g:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/pthread.h:365:68: error: 'size_t' has not been declared
int WINPTHREAD_API pthread_attr_setstacksize(pthread_attr_t *attr, size_t size);
^
main.cpp: In function 'int main()':
main.cpp:6:17: error: 'system' was not declared in this scope
system ("pause");
^
N:\MyWorks\DevC++\Makefile.win:28: recipe for target 'main.o' failed
mingw32-make.exe: *** [main.o] Error 1
编译结果...
--------
- 错误: 49
- 警告: 0
- 编译时间: 1.05s
[/code]
以前从来没有遇到这样的情况,求大神们给个思路,怎么搞?