I was playing around with some multithreading example code shown below (taken from from http://www.bogotobogo.com/cplusplus/multithreading_win32A.php) using codeblocks (build option was set to c++11).
#include <windows.h>
#include <iostream>
#include <stdio.h>
DWORD WINAPI myThread(LPVOID lpParameter)
{
unsigned int& myCounter = *((unsigned int*)lpParameter);
while(myCounter < 0xFFFFFFFF) ++myCounter;
return 0;
}
int main(int argc, char* argv[])
{
using namespace std;
unsigned int myCounter = 0;
DWORD myThreadID;
HANDLE myHandle = CreateThread(0, 0, myThread, &myCounter, 0, &myThreadID);
char myChar = ' ';
while(myChar != 'q') {
cout << myCounter << endl;
myChar = getchar();
}
CloseHandle(myHandle);
return 0;
}
When I built the project the "cwchar" file was opened and I got the huge list of "has not declared" errors shown below. I'm not sure what's wrong here, any ideas?
||=== Build: Debug in TEST2 (compiler: GNU GCC Compiler) ===|
c:mingwlibgccmingw325.3.0includec++cwchar|177|error: '::wcscat' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|178|error: '::wcscmp' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|179|error: '::wcscoll' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|180|error: '::wcscpy' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|181|error: '::wcscspn' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|183|error: '::wcslen' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|184|error: '::wcsncat' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|185|error: '::wcsncmp' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|186|error: '::wcsncpy' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|188|error: '::wcsspn' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|193|error: '::wcstok' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|196|error: '::wcsxfrm' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|204|error: '::wcschr' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|205|error: '::wcspbrk' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|206|error: '::wcsrchr' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar|207|error: '::wcsstr' has not been declared|
c:mingwlibgccmingw325.3.0includec++cwchar||In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':|
c:mingwlibgccmingw325.3.0includec++cwchar|213|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:mingwlibgccmingw325.3.0includec++cwchar|212|note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)'|
c:mingwlibgccmingw325.3.0includec++cwchar||In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)':|
c:mingwlibgccmingw325.3.0includec++cwchar|217|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:mingwlibgccmingw325.3.0includec++cwchar|216|note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)'|
c:mingwlibgccmingw325.3.0includec++cwchar||In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)':|
c:mingwlibgccmingw325.3.0includec++cwchar|221|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:mingwlibgccmingw325.3.0includec++cwchar|220|note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)'|
c:mingwlibgccmingw325.3.0includec++cwchar||In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)':|
c:mingwlibgccmingw325.3.0includec++cwchar|225|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:mingwlibgccmingw325.3.0includec++cwchar|224|note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)'|
c:mingwlibgccmingw325.3.0includec++itschar_traits.h|358|error: 'wcslen' was not declared in this scope|
||=== Build failed: 21 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…