Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

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.

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

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


Link to post
Share on other sites
Advertisement
Link to D3D9.LIB.

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


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


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


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

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!