Compilation error using x86_64-w64-mingw32-c++.exe
resis10ce opened this issue · comments
Hi, i am using mingw c++ compiler for compiling klog_main but i got this error.
i am unable to get thee issue
x86_64-w64-mingw32-c++.exe ../klog_main.cpp
../klog_main.cpp: In function 'void SetHook()': ../klog_main.cpp:56:26: error: cannot convert 'LPCWSTR' {aka 'const wchar_t*'} to 'LPCSTR' {aka 'const char*'} MessageBox(NULL, a, b, MB_ICONERROR);
In file included from C:/tools/Delet/mingw64/x86_64-w64-mingw32/include/Windows.h:72, from ../klog_main.cpp:1: C:/tools/Delet/mingw64/x86_64-w64-mingw32/include/winuser.h:3566:54: note: initializing argument 2 of 'int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)' WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType);
@resis10ce I managed to fix that by explicitly casting to LPCSTR. Replace line 56 (the one throwing an error) with this
MessageBox(NULL, (LPCSTR)a, (LPCSTR)b, MB_ICONERROR);
then try to compile it the the same way you did. It worked for me.