Compilation errors in Visual Studio 2019
automatedbugreportingfacility opened this issue · 1 comments
automatedbugreportingfacility commented
The program cannot be compiled in Visual Studio 2019:
1>C:\...\DLLInjector\Source.cpp(21,30): error C2734: 'dllPath': 'const' object must be initialized if not 'extern'
1>C:\...\DLLInjector\Source.cpp(22,37): error C2664: 'size_t wcstombs(char *,const wchar_t *,size_t)': cannot convert argument 1 from 'const char [260]' to 'char *'
1>C:\...\DLLInjector\Source.cpp(22,37): message : Conversion loses qualifiers
1>C:\...\DLLInjector\Source.cpp(65,36): error C2664: 'void printError(TCHAR *)': cannot convert argument 1 from 'const char [15]' to 'TCHAR *'
1>C:\...\DLLInjector\Source.cpp(65,36): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>C:\...\DLLInjector\Source.cpp(74,6): error C2664: 'int wcscmp(const wchar_t *,const wchar_t *)': cannot convert argument 1 from 'CHAR [260]' to 'const wchar_t *'
1>C:\...\DLLInjector\Source.cpp(74,6): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>C:\...\DLLInjector\Source.cpp(75,12): warning C4477: 'wprintf' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'CHAR *'
1>C:\...\DLLInjector\Source.cpp(75,12): message : consider using '%hs' in the format string
1>C:\...\DLLInjector\Source.cpp(75,12): message : consider using '%Ts' in the format string
1>C:\...\DLLInjector\Source.cpp(75,12): message : this warning is based on non-standard semantics used by Visual C++
1>C:\...\DLLInjector\Source.cpp(90,9): warning C4477: 'printf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'WCHAR *'
1>C:\...\DLLInjector\Source.cpp(90,9): message : consider using '%ls' in the format string
1>C:\...\DLLInjector\Source.cpp(90,9): message : consider using '%lls' in the format string
1>C:\...\DLLInjector\Source.cpp(90,9): message : consider using '%Ls' in the format string
1>C:\...\DLLInjector\Source.cpp(90,9): message : consider using '%ws' in the format string
1>C:\...\DLLInjector\Source.cpp(107,36): error C2664: 'void printError(TCHAR *)': cannot convert argument 1 from 'const char [15]' to 'TCHAR *'
1>C:\...\DLLInjector\Source.cpp(107,36): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>C:\...\DLLInjector\Source.cpp(117,40): error C2664: 'void printError(TCHAR *)': cannot convert argument 1 from 'const char [19]' to 'TCHAR *'
1>C:\...\DLLInjector\Source.cpp(117,40): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>C:\...\DLLInjector\Source.cpp(123,85): error C2664: 'HMODULE GetModuleHandleA(LPCSTR)': cannot convert argument 1 from 'const wchar_t [13]' to 'LPCSTR'
1>C:\...\DLLInjector\Source.cpp(123,85): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>C:\...\DLLInjector\Source.cpp(126,37): error C2664: 'void printError(TCHAR *)': cannot convert argument 1 from 'const char [15]' to 'TCHAR *'
1>C:\...\DLLInjector\Source.cpp(126,37): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
1>C:\...\DLLInjector\Source.cpp(134,42): error C2664: 'void printError(TCHAR *)': cannot convert argument 1 from 'const char [19]' to 'TCHAR *'
1>C:\...\DLLInjector\Source.cpp(134,42): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
Bzkirito commented
Visual Studio 2019 has more stringent specification checks , you should follow the instructions