I was trying to include windows.h and iostream together in the following little test program.
when iostream was included after windows.h as in the example below:
#include <windows.h>
#include <stdio.h>
#include <iostream>
int main(void)
{
printf("hello world");
return 0;
}
it caused the following error:
||=== Build: Debug in TEST10 (compiler: GNU GCC Compiler) ===|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|177|error: '::wcscat' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|178|error: '::wcscmp' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|179|error: '::wcscoll' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|180|error: '::wcscpy' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|181|error: '::wcscspn' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|183|error: '::wcslen' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|184|error: '::wcsncat' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|185|error: '::wcsncmp' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|186|error: '::wcsncpy' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|188|error: '::wcsspn' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|193|error: '::wcstok' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|196|error: '::wcsxfrm' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|204|error: '::wcschr' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|205|error: '::wcspbrk' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|206|error: '::wcsrchr' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|207|error: '::wcsstr' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar||In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|213|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|212|note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)'|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar||In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)':|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|217|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|216|note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)'|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar||In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)':|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|221|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|220|note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)'|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar||In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)':|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|225|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|224|note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)'|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h|358|error: 'wcslen' was not declared in this scope|
||=== Build failed: 21 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===|
however when changed to the following it worked fine.
#include <iostream>
#include <windows.h>
#include <stdio.h>
int main(void)
{
printf("hello world");
return 0;
}
I'm not sure why the order of the includes should matter and am curious as to why this occurs?
Aucun commentaire:
Enregistrer un commentaire