When I compile a simple C++ program like this:
#include<iostream>
using namespace std;
int main()
{
cout << "hello word" << endl;
return 0;
}
I got some error message,
This is part of the error message:
In file included from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\cstdlib:75,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ext\string_conversions.h:41,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\basic_string.h:6391,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:52,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38,
from e:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39,
from F:\Desktop\web\web\work_one\test.cpp:1:
e:\mingw\include\stdlib.h:90:1: error: '_BEGIN_C_DECLS' does not name a type
_BEGIN_C_DECLS
^~~~~~~~~~~~~~
e:\mingw\include\stdlib.h:363:1: error: '__CRT_ALIAS' does not name a type
__CRT_ALIAS __cdecl __MINGW_NOTHROW
^~~~~~~~~~~
e:\mingw\include\stdlib.h:367:1: error: '__CRT_ALIAS' does not name a type
__CRT_ALIAS __cdecl __MINGW_NOTHROW
^~~~~~~~~~~
e:\mingw\include\stdlib.h:444:55: error: '_locale_t' has not been declared
__int64 _wcstoi64_l(const wchar_t *, wchar_t **, int, _locale_t);
^~~~~~~~~
e:\mingw\include\stdlib.h:447:65: error: '_locale_t' has not been declared
unsigned __int64 _wcstoui64_l(const wchar_t *, wchar_t **, int, _locale_t);
^~~~~~~~~
e:\mingw\include\stdlib.h:866:1: error: '_END_C_DECLS' does not name a type
_END_C_DECLS
^~~~~~~~~~~~
This seems to be a problem with the header file syntax, but I did not modify the head file.
I use this command to compile:
g++ -g -std=c++11 F:\Desktop\web\web\work_one\test.cpp -o test.exe
My operating system is Win10.
The g++ version is g++ (MinGW.org GCC-8.2.0-3) 8.2.0
G++ I got from http://www.mingw.org/