the Compiler says ..
||=== Build: Debug in ComboBox (compiler: GNU GCC Compiler) ===|
|In function 'void ComboBox(HWND)':|
|39|error: 'wcscpy_s' was not declared in this scope|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I add the <cstring> and even the <wchar> to load the funcions, but is not working either with these 2 headers
#include <cstring> // for wcscpy_s, wcscat_s
#include <cstdlib> // for _countof
#include <iostream> // for cout, includes <cstdlib>, <cstring>
#include <errno.h> // for return values
int main(void)
{
wchar_t string[80];
// using template versions of wcscpy_s and wcscat_s:
wcscpy_s(string, L"Hello world from ");
wcscat_s(string, L"wcscpy_s ");
wcscat_s(string, L"and ");
// of course we can supply the size explicitly if we want to:
wcscat_s(string, _countof(string), L"wcscat_s!");
std::wcout << L"String = " << string << std::endl;
}
TCHAR is not a good choice to use when dealing with wide-char/Unicode strings and functions. It is a generic type that can change whether Unicode is defined or not. Use WCHAR or wchar_t instead.
According to MS wcscpy_s requires either sting.h or wchar.h. Since this example uses TCHAR you also need tchar.h.
It also might be the problem with GCC not fully implementing the Win SDK.
But i resolve it.
As they use wcscpy_s, that is declared in string.h on Windows, but may not be declared in gcc compilers, and when they wrote this code they didn't specify I have to include <wchar.h> or <cstring>, or whatever.
I tryed wcscpy also but it takes only 2 arguments. Also, they are using TCHAR for wcscpy_s, as it is Unicode only.