I have an application that I originally worked on on VS 2019 with no issue compiling whatsoever and that would now need to be compiled with GCC. I'm essentially trying to create a Ruby 3.2.0 virtual machine in C++ on Windows. I started porting the project to VS Code, but once I tried to build the project, I got errors related to wide char to char conversions.
#define _UNICODE#define UNICODE#define CLASS_NAME L"Test" // Error
cannot convert 'const wchar_t [5]' to 'LPCSTR' {aka 'const char*'} in assignment
I have no idea what's going on here since this is just a define command, but this might give a clue as to what the underlying issue is.
UnregisterClassW(wc.lpszClassName, instance); // wc is a WNDCLASSW
cannot convert 'LPCSTR' {aka 'const char*'} to 'LPCWSTR' {aka 'const wchar_t*'}
The big issue here that's driving me crazy is that the lpszClassName property is already a LPCWSTR, the argument type required by UnregisterClassW.
I made sure to include the UNICODE macros, but it did not fix the issue. Although the macros are already defined in the defines field of the c_cpp_properties.json file, I added them in case they were undefined by any of the Ruby libraries.
I also have no experience with GCC or any other compiling method than with Visual Studio, so maybe I'm missing something obvious.