# Using Visual C++ 2005 Express Edition Beta with Direct3d, error: _Direct3DCreate9@4

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

## Recommended Posts

Hi im using Visual C++ 2005 Express Edition Beta with Direct3d, but I keep getting the error below:
Quote:
 ------ Build started: Project: Landscape, Configuration: Debug Win32 ------ Compiling... cdirect3d.cpp Linking... cdirect3d.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: bool __thiscall CDirect3d::initialise(class CWindow *,unsigned long,bool,int,int)" (?initialise@CDirect3d@@QAE_NPAVCWindow@@K_NHH@Z) Debug/Landscape.exe : fatal error LNK1120: 1 unresolved externals Build log was saved at "file://c:\Docs\Programming\Landscape\Landscape\Debug\BuildLog.htm" Landscape - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I was using MinGW studios before this and I was getting the same error, and I was supposed to get some third party libs to make it work or something. So i switched to visual c++ 2005 express edition beta, thinking since its microsoft's. it should work fine!. Btw I've done this before with visual c++ 6 and it works fine there, but I rather use this later edition. thanks

##### Share on other sites

Easiest way to do that is by adding #pragma comment (lib, "d3d9.lib").

Unresolved externals always mean that you either forgot to add a source file to your project or that you forgot to link to a library. The name of the missing function (Direct3DCreate9) should give you a good idea.

##### Share on other sites
I've got d3d9.lib added and #include <d3d9.h> there too.

I'm still not sure whats wrong. I've also got the directories settings for Lib and Include entered with the dxSdk libs and includes which are both at the top of their lists.

##### Share on other sites
Have you tried starting from scratch? Create a new Win32 application and add the following code:

#include <windows.h>#include <d3d9.h>#pragma comment (lib, "d3d9.lib")int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCommandLine, int cmdShow){	IDirect3D9 *d3d = Direct3DCreate9 (D3D_SDK_VERSION);	d3d->Release ();}

Works for me.

##### Share on other sites
Make sure the file that contains the function is added to project on the left hand side. (in solution explorer) :)

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 14
• 40
• 63