[英]Access violation writing location 0x00000000
When the application reaches these lines of code: 当应用程序到达以下代码行时:
ID3D11ShaderResourceView* tempMeshSRV;
wstring MediaFilePath = DefaultPath + fileNamePath;
hr = D3DX11CreateShaderResourceViewFromFile( d3d11Device, MediaFilePath.c_str(), NULL, NULL, &tempMeshSRV, NULL );
I get the following error: 我收到以下错误:
Unhandled exception at 0x011428b5 in Game.exe: 0xC0000005: Access violation writing location 0x00000000. Game.exe中0x011428b5处未处理的异常:0xC0000005:访问冲突写入位置0x00000000。
It was working fine until I added the "wstring MediaFilePath = DefaultPath + fileNamePath;" 在添加“ wstring MediaFilePath = DefaultPath + fileNamePath;”之前,它一直运行良好。 line.
线。 The resource it is trying to load is definitely in the correct location.
它尝试加载的资源肯定在正确的位置。
Do DefaultPath and fileNamePath have type "wstring" or "const wchar_t*"? DefaultPath和fileNamePath是否具有“ wstring”或“ const wchar_t *”类型? If they're "const wchar_t*", then adding them won't do what you want it to.
如果它们是“ const wchar_t *”,那么添加它们将无法完成您想要的操作。 (It'll add the two pointer values).
(它将添加两个指针值)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.