我一直使用 MinGW 或 Dev-C++ 在 Microsoft Windows 上用 C++ 编写代码,但现在我必须使用 Code Blocks。我已经按照标准程序下载并安装了它。
我尝试运行超级简单的 HelloWorld.cpp 示例文件,但出现许多编译错误:
#include <iostream>
using namespace std;
int main()
{
cout << “Hello World!” << endl;
}
这是我的编译器错误列表:
Compiling: C:\Temp7\provaC\test00.cpp
In file included from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstring:49,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/c++locale.h:42,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iosfwd:46,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ios:44,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ostream:45,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iostream:45,
from C:\Temp7\provaC\test00.cpp:1:
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstddef:52: error: `::ptrdiff_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstddef:53: error: `::size_t' has not been declared
In file included from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstring:51,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/c++locale.h:42,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iosfwd:46,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ios:44,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ostream:45,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iostream:45,
from C:\Temp7\provaC\test00.cpp:1:
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:36: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:37: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:38: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:39: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:40: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:46: error: expected constructor, destructor, or type conversion before "strcspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:46: error: expected `,' or `;' before "strcspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:49: error: expected constructor, destructor, or type conversion before "strlen"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:49: error: expected `,' or `;' before "strlen"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:50: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:51: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:52: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:55: error: expected constructor, destructor, or type conversion before "strspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:55: error: expected `,' or `;' before "strspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:58: error: expected constructor, destructor, or type conversion before "strxfrm"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:58: error: expected `,' or `;' before "strxfrm"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:65: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:66: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:72: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:73: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:77: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:80: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:81: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:90: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:91: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:100: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:102: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:104: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:109: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:125: error: expected constructor, destructor, or type conversion before "wcscspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:125: error: expected `,' or `;' before "wcscspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:127: error: expected constructor, destructor, or type conversion before "wcslen"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:127: error: expected `,' or `;' before "wcslen"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:128: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:129: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:130: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:133: error: expected constructor, destructor, or type conversion before "wcsspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:133: error: expected `,' or `;' before "wcsspn"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:136: error: expected constructor, destructor, or type conversion before "wcsxfrm"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:136: error: expected `,' or `;' before "wcsxfrm"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:150: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:151: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:157: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:158: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:175: error: `size_t' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/string.h:176: error: `size_t' has not been declared
In file included from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/c++locale.h:42,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iosfwd:46,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ios:44,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ostream:45,
from C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iostream:45,
from C:\Temp7\provaC\test00.cpp:1:
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstring:89: error: `::strxfrm' has not been declared
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstring:90: error: `::strcspn' has not been declared
Process terminated with status 1 (0 minutes, 5 seconds)
似乎在标准库中缺少某些结构(ptr_diff_t
,size_t
等)。
有人可以帮我编译一下简单的 HelloWorld.cpp 吗?
谢谢!