D3DXSaveSurfaceToFile error 1120

Started by
4 comments, last by Micronaut 13 years, 7 months ago
I am running DirectX 9 through 11 on Visual C++ Express and most of the features are running fine, but when I try to use D3DXSaveSurfaceToFile, D3DXLoadSurfaceFromFile or any other related function I get: 1>AGSpiral.obj : error LNK2001: unresolved external symbol _D3DXSaveSurfaceToFileW@20
AND fatal error LNK1120: 1 unresolved externals. I have configured the include and lib folders for DirectX SDK, and added what is supposed to be in the Linker Input.
Here is the code the generated the previous error:
/////////////////
IDirect3DSurface9* pSurface;
g_pDevice->CreateOffscreenPlainSurface(SCREEN_WIDTH, SCREEN_HEIGHT,
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL);
g_pDevice->GetFrontBufferData(0, pSurface);
D3DXSaveSurfaceToFile(L"C:\\Desktop.bmp",D3DXIFF_BMP,pSurface,NULL,NULL);
pSurface->Release();
/////////////////
(const int SCREEN_WIDTH = 1366; and const int SCREEN_HEIGHT = 768;)
If I comment out the D3DXSaveSurfaceToFile call the program compiles fine.
Advertisement
Quote:Original post by Micronaut
and added what is supposed to be in the Linker Input.


Post exactly what this includes, and double-check that d3dx9.lib is really there.
You need to add d3dx9.lib to your programs additional dependencies in Project Settings (Alt+F7) -> Configuration Properties -> Linker -> Input -> Additional Dependencies (And you want d3dx9d.lib in debug builds).

EDIT: Bah, too slow [smile]
My Linker settins are: Configuration Properties>Linker>Input>Additional Dependencies>dxguid.lib;d3d9.lib;d3dx9.lib;etc.
Try calling D3DXSaveSurfaceToFileA (note: A, not W) directly and see what happens. I'm not proposing this as a solution (and wouldn't recommend that you do it), just a test to see if your problem is character set related.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I've explicitly called both A and W, but thanks.

This topic is closed to new replies.

Advertisement