#### Archived

This topic is now archived and is closed to further replies.

# pointing VC++ to DX

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

## Recommended Posts

hey folks, I was wondering how I include the DirectX libraries in my project, I pasted the .h and .lib files from the SDK into VC''s appropriate folders, but that didn''t work I know there is something somewhere to point VC to DX6 but where is it? thanks, -arsenius after three days without programming, life becomes meaningless

##### Share on other sites
To set the library and header directories to include the latest DirectX SDK, go to "Options..." under the Tools menu. Under the "Directories" tab, set the appropriate SDK directories for header files and Library files -- the SDK directories must be the first entries on each list! This is because otherwise, VC++ would first find the headers for whatever version of DirectX shipped with the compiler.

To add a DirectX library to your current project, go under the Project menu, select "Add to project ->", and then "Files...". The file dialog box comes up. Just find the appropriate library and select it, and it will be included in your project.

-Ironblayde
Aeon Software

##### Share on other sites
I just tried that to no avail
I''m just trying to initialize directdraw heres the code that is causing me problems:
  int GameInit(){ if (FAILED(DirectDrawCreate(NULL, &templpdd, NULL))) return 0; if (FAILED(templpdd->QueryInterface(IID_IDirectDraw4, (LPVOID*)&lpdd))) { templpdd->Release(); return 0; } templpdd->Release(); templpdd = NULL; return 1;} (lamothe code)

I set the directories properly w/ DX at the top, and I also included ddraw.h and ddraw.lib in my project
what else can I do?

thanks,

-arsenius

after three days without programming, life becomes meaningless

##### Share on other sites
What exactly is the error you are getting? I find nothing wrong with your code, and I hope the release of the object within the function is just there for display purposes and not in the actual program, or there''s your mistake! If the error you are getting is something like IID_DirectDraw4 is an invalid statement, then try to include DXGUID.LIB into your project. That''s the best i can do without the specific error, cause i had a problem with querying the latest version using IDD_DirectDraw4 and hadn''t included DXGUID.LIB. Hope this helps.

==============================
"You don''t know the power of the Dark Side..."

==============================

##### Share on other sites
Another thought:

Make sure you are defining lpdd as LPDIRECTDRAW4, and not LPDIRECTDRAW. I did that and spent weeks until i found that missing "4". You wanna see mad? I was PISSED!

P.S. - You are correct to release the old templpdd, sorry.

==============================
"You don't know the power of the Dark Side..."

==============================

Edited by - Gaiiden on August 30, 2000 7:50:35 PM

Edited by - Gaiiden on August 30, 2000 7:51:57 PM

##### Share on other sites
thanks Gaiiden and Ironblayde, including dxguid.lib fixed it YEAH!!! now I can get back to programming. btw, what does dxguid.lib do exactly?
later,

-arsenius

after three days without programming, life becomes meaningless

##### Share on other sites
LOL, glad to see someone else did the same thing! I actually wrote to Andre LaMothe ("Tricks of the Windows Game Programming Gurus")about this problem after solving it myself and he said he covered it in his book but I guess not as well as he thought .

To answer you''re question, arsenius, first let me relearn it myself *opens up book* Ahh, here we go -

A GUID is a Globally Unique Identifier that is used to reference a COM object. When defining interfaces (DirectDraw is an interface of DirectX object) it''s an IID (look familiar?) or Interface ID. A GUID is a 128-bit vector and is created so that no same vector can be generated again on any machine at any time (don''t ask me how this works, it involves too much math). GUID.LIB carries the GUIDs of all the DirectX interfaces, so not including it into your project would cause QueryInterface to fail miserably.

Well, *shuts book*, glad I could be of service.

==============================
"You don''t know the power of the Dark Side..."

==============================

##### Share on other sites
Perhaps you could look at this thread

DirectDraw7 doesn''t like me

One of the replys by me (Cygon) contains a step-by-step explanation on how to set up a workspace using DirectDraw. If you''d like to use other DirectX parts, just add DInput.lib, D3Dim.lib or DSound.lib in the appropriate spaces where DDraw.lib was added

-Markus-