these are the variables:
std::wstring wsPath = L"./LIFE.bmp"; // path to the image
IDirect3DSurface9 *Surface = NULL; // image surface
IDirect3DSurface9 *BackBuffer = NULL; // back buffer surface
and this is the render()
function:
void render(void)
{
// Check to make sure you have a valid Direct3D device
if (NULL == pd3dDevice) return;
pd3dDevice -> Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0); // clear the back buffer to a blue color
if (SUCCEEDED(pd3dDevice -> BeginScene()))
{
D3DXIMAGE_INFO Info;
D3DXGetImageInfoFromFile(wsPath.c_str(), &Info);
pd3dDevice -> CreateOffscreenPlainSurface(Info.Width, Info.Height, Info.Format, D3DPOOL_SYSTEMMEM, &Surface, NULL);
D3DXLoadSurfaceFromFile(Surface, NULL, NULL, wsPath.c_str(), NULL, D3DX_FILTER_NONE, 0, NULL);
pd3dDevice -> GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);
pd3dDevice -> UpdateSurface(Surface, NULL, BackBuffer, NULL);
// End the scene
pd3dDevice -> EndScene();
}
// Present the back buffer contents to the display
pd3dDevice -> Present(NULL, NULL, NULL, NULL);
}
i keep getting this strange error:
1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXLoadSurfaceFromFileW@32 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)
1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXGetImageInfoFromFileW@8 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)
Can you explain to me what is happening here? Thank you!
The linker is letting you know that it can't find the function D3DXLoadSurfaceFromFile and D3DXGetImageInfoFromFile.
Check your linker settings to make sure that you including the required libs.
The library in question is D3dx9.lib.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.