vs2019报错E0167 “const wchar_t *“ 类型的实参与 “WCHAR *“ 类型的形参不兼容

解决方法参考:

vs2019报错说 E0167 "const wchar_t *" 类型的实参与 "LPCSTR" 类型的形参不兼容 - Thermo - 博客园f

参考二

c++ - Convert const wchar_t* into a WCHAR* - Stack Overflow

原因是2017之后,c++不再支持这种写法???

所以,改了一下方法的参数:

WCHAR* -> WCHAR const *

void ColorShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage,
 HWND hwnd, WCHAR const * shaderFilename)
{
   
   

.cpp

.h

2个文件都要改

@selbie With recent standard conformance improvements vc++ won't tolerate string literal assignment to pointer to non-const char anymore. As for question itself, declaring it like WCHAR const *vsFilename or as LPCWSTR vsFilename should fix the error. 

– user7860670

 Jan 21, 2018 at 8:01 

至于,WCHAR*指针,wschar, const 和L"" ,到底是什么鬼,之后再看看吧

猜你喜欢

转载自blog.csdn.net/avi9111/article/details/123571677