# fatal error LNK1120: 1 unresolved externals

This topic is 3762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am facing a linker error problem and don't know how to solve it. The error that comes up is: d3dUtil.obj : error LNK2001: unresolved external symbol "struct IDirect3DDevice9 * m_pD3DDevice" I have defined m_pD3DDevice in a file called App.h. In the header file d3dUtil.h I have included App.h and also provided an external reference to m_pD3DDevice. Could someone tell me what the problem might be? Thanks.

##### Share on other sites
It's a linker error. This means that your include mechanics are correct (everything compiled), but ultimately, when producing the executable, all of your .cpp files assumed m_pD3DDevice was coming from somewhere else (extern) - and none had the actual variable declared in the end.

If you declare a variable as extern, there has to be exactly one place where the variable is declared for real. You can do this, for example, by adding another file to your project only containing the lines

#include <d3d9.h>struct IDirect3DDevice9 *m_pD3DDevice;

##### Share on other sites
Hi

You need to link d3dx library. Right click on your project name on panel, select properties, Under Linker select input and in additional dependencies write d3dx9.lib d3d9.lib

##### Share on other sites
You can also do

#pragma comment(lib, "d3d9.lib")

##### Share on other sites
You guys don't seem to get that the original poster is not missing d3d9.lib, d3dx9.lib or anything else (at least, not yet ;))

There's simply a bug in his code. Maybe he's using the DX application framework and didn't put all necessary source files in his project, maybe he called on of his own files d3dUtil.cpp (that's what I'm assuming, because of the uppercase 'U') and didn't get the external right.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 20
• 14
• ### Forum Statistics

• Total Topics
632950
• Total Posts
3009377
• ### Who's Online (See full list)

There are no registered users currently online

×