Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with Direct3D Initialization

Started by BlackGhost Mar 20, 2003 at 11:00 AM 4 replies 1.6k views
Original Post
BlackGhost
BlackGhost
Hi, I''m trying to initialize Direct3D in C++ as shown in the tutorials. I use both VS.NET and VC6 but get the same error (unresolved external symbol _Direct3DCreate9@4 or something like that) in the line: if(NULL == (pD3D = Direct3DCreate8(D3D_SDK_VERSION))) return E_FAIL; (Exactly like in the tutorial). Is anything else required to be included except d3d9.h? Exactly the same thing occurs if I try to use DirectX 8 instead of 9. It seems very strange to me because samples who seem to have this same code, run normally. Any ideas? Thanks to anyone who might answer.
IFooBar
IFooBar
are you linking in the lib file? If not try adding this line to any source file

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

That line just links in the d3d9 library, which you need to link in order to compile d3d9 stuffage.


:::: [ Triple Buffer V2.0 ] ::::
[size=2]aliak.net
evaclear
evaclear
you need to include the d3d9.lib files and dxguid.lib as well. And for gods sake include them the way they were ment to be included and not in some #pragma. That makes for some very ugly code.

[edited by - evaclear on March 20, 2003 1:47:12 PM]
Joseph FernaldSoftware EngineerRed Storm Entertainment.------------------------The opinions expressed are that of the person postingand not that of Red Storm Entertainment.
BlackGhost
BlackGhost
Sorry but I''m not any good at C++. Could you please explain in more detail how to link these files? The #pragma directive doesn''t fix the error. How can I include the two files you mention? If I add #include "d3d9.lib" it says it can''t find the file...
Mastaba
Mastaba
You need to link the Direct3D 8 libs, not the Direct3D 9 that those above have shown.
The Frugal Gourmet
The Frugal Gourmet
It depends on what compiler you are using. If you are using VC7, right-click your project, go into linker settings, and add the appropriate libraries.

Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.