Я всегда использовал MinGW или Dev-C ++ для написания кода на C ++ в Microsoft Windows, но теперь я должен использовать блоки кода.
Я скачал и установил, со стандартной процедурой.
Я пытался запустить пример файла supersimple 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?
Спасибо!
Это ваши кавычки, которые вызывают проблему:
Смотри как “”
отличается от ""
? Вот почему он не компилируется. Они не являются допустимыми символами в C ++.
Вы используете неправильные кавычки .. Изменить “
а также ”
в ""