C++找不到文件
C++ File Not Found
早上好, 我正在使用DX11编写游戏引擎。我的问题是找不到帮助程序文件。可执行文件的路径为C:UsersaPlutonicCoderDocumentsVisual Studio 2017ProjectsGameEngineDebugGraphicsEngine.exe
。帮助程序文件的路径为C:UsersaPlutonicCoderDocumentsVisual Studio 2017ProjectsGameEngineDebugColor Filescolor.ps
和C:UsersaPlutonicCoderDocumentsVisual Studio 2017ProjectsGameEngineDebugColor Filescolor.vs
。相关代码为:
bool ColorShaderclass::InitializeShader(ID3D11Device* deviceContext, HWND hwnd, LPCSTR vsFileName, LPCSTR psFileName)
{
HRESULT hresult;
ID3DBlob* errorMessage;
ID3DBlob* vertexShaderBuffer;
ID3DBlob* pixelShaderBuffer;
D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
unsigned int noElements;
D3D11_BUFFER_DESC matrixBufferDesc;
errorMessage = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
hresult = D3DX11CompileFromFile(vsFileName, NULL, NULL, "ColorVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, &errorMessage, NULL);
if (FAILED(hresult))
{
if (errorMessage)
OutputShaderErrorMessage(errorMessage, hwnd, vsFileName);
else
MessageBox(hwnd, vsFileName, "Missing Shader File", MB_OK);
return false;
}
hresult = D3DX11CompileFromFile(psFileName, NULL, NULL, "ColorPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, &errorMessage, NULL);
if (FAILED(hresult))
{
if(errorMessage)
OutputShaderErrorMessage(errorMessage, hwnd, psFileName);
else
MessageBox(hwnd, vsFileName, "Missing Shader File", MB_OK);
return false;
}
bool ColorShaderclass::Initialize(ID3D11Device* device, HWND hwnd)
{
return InitializeShader(device, hwnd, ".../Color Files/color.vs", ".../Color Files/color.ps");
}
请帮助我。文件在那里并且存在,但弹出消息框。提前谢谢你
你可以试试这个:
InitializeShader(device, hwnd, Path::GetFullPath("Color Files/color.vs"), Path::GetFullPath("Color Files/color.ps"));
相关文章:
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 找不到QtResource文件中的文件
- "assimp/config.h"找不到,但它在文件夹中
- C++系统找不到指定的文件错误
- 在 Ubuntu 18.04 上,我编译的 cpp 可执行文件找不到 VTK7 依赖项
- Pyinstaller创建的可执行文件找不到Meipass目录中存在的DLL
- 如何修复"QtCharts"库文件找不到/无法包含<QtCharts>?
- 为什么生成文件找不到包含目录
- 我的类在 .h 文件中定义,.cpp文件找不到
- 生成文件找不到 .o 文件
- 部署Qt-dll文件-找不到windows插件,尽管平台/qwindows.dll存在,因此存在libEGL和libGL
- 资源中的文件找不到本地文件
- C++包括 C 文件(找不到 typedef)
- C++生成文件找不到文件
- Xcode 6.0.1版gmp.h头文件找不到,尽管gmp.h和gmpxx.h在local/include中
- 生成文件找不到同一目录中的文件
- 我的生成文件找不到我的头目录
- 包含的文件 <> 找不到 " " 中包含的文件
- 突然间,Ogre头文件找不到(DEVELOPER_DIR随着Xcode更新而改变)
- 尝试在Xcode 5中包含头文件.找不到文件