Jump to content
  • Advertisement
Sign in to follow this  
Drats

fatal error LNK1120: 1 unresolved externals

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!