Please Help with Beginning DirectX Programming

This is a discussion on Please Help with Beginning DirectX Programming within the Game Programming forums, part of the General Programming Boards category; I am starting to use DirectX, and I get the code and all, but the problem is that I really ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103

    Please Help with Beginning DirectX Programming

    I am starting to use DirectX, and I get the code and all, but the problem is that I really don't know how to add the libraries to my compiler. Right now I am using Microsoft Visual C++ 6.0 Standad Edition. Right now I am in DirectDraw, as we all know, the .lib is called ddraw.lib . I really don't know how really to add it. I just know one way to add the files,but it doesn't really work. I think you go to Project->Add Files, from there I add the library and the header file "ddraw.h". Yet when I compile, I recieve 3 errors. It tells me that it doesn't recognize the DirectObject of Direct Draw Interface 4 of DirectX 6.0. Microsoft C++ has a built in DirectX 3.0, that's why I recieved only 3 errors and not a gazillion. Can someone help me?? Please. I have read on other tutorials that you go to Project->Settings then go to linker, and add the "ddraw.lib" and "ddraw.h" to the other .libs, so that Visual C++ can do something with it. Please, someone help me, I really don't know how to fix this problem. How can you really add the libraries to the compiler? I really want to start using DirectX so I can become a better game programmer .

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Code:
    #pragma comment(lib,"d3d9.lib")
    Don't use pre-D3D9. DirectDraw is obsolete.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    You must add the SDK folder to your library search paths for MSVC.

    Then in the link section you must add the libraries you will be using for your current project. The search paths apply to the entire IDE, regardless of project, and the link section only applies to your current project.

    The paths tell MSVC where to find the headers and libraries. It will search everything in the list and then if it cannot resolve the symbol then it will issue an error. Make sure your SDK paths are at the TOP of the list or it won't work right.

    Here is a shot of my link environment for a game I'm working on.

    This is in Project->Settings...->Link->General in the drop down box

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    This is a shot of my MSVC Tools->Options. These are global to the compiler for all projects.

    This is showing the include file information. In other words where should MSVC look for include files.

    To view libraries, source, etc, simply change the item in the drop down box to the desired setting. Everything can be changed from here.

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Now don't specifically add header (.h) files to your tools->options or Project->Settings->Link->General section. Add header files as #include <header.h> in your header files for your project. So all you need is this:

    • Set the include and library paths for the compiler.
    • Add libraries to the link section for your project.


    For instance if you are using ::TransparentBlt() in your project you will find that it is in msimg32.dll (dynamic library) and msimg32.lib (static library). So in your library section you would add msimg32.lib or add the dll.

    Most of the libraries you will need for any DirectX app are:

    d3d9.lib - Direct3D version 9.0 library
    d3dx9.lib - Direct3D extensions library for Direct3D 9.0
    dsound.lib - DirectSound library
    dinput.lib - DirectInput base library
    dinput8.lib - DirectInput version 9 library
    winmm.lib - Windows multi-media library
    dxguid.lib - DirectX GUID (Globally Unique IDentifier) library

    For other things like DirectPlay, DirectMusic, DirectShow, etc., you will add the appropriate libraries. The SDK tells you which ones you need to add to gain the functionality you want.
    Last edited by VirtualAce; 11-09-2005 at 11:41 PM.

  6. #6
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Thankyou very much..Now I now what to do...I'll try it as soon as possible, right after I get out of school. Thankyou very much bubba, it's for sure that you're a great programmer.

  7. #7
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Please help me...I've done everything you told me bubba. When I compile it it gives me an error. It tells me that ID_DirectDraw4 is an unresolved external symbol or something like that. Do you have to replace the ddraw.lib that the compiler somes with, with the one I am using? What's wrong with my compiler, what's happening, please someone help me...

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    Sounds like it's not linked properly.

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Use the libraries that come with your SDK, not your compiler. MSVC was programmed eons ago and the DirectX distributed with your compiler is also very old. MSVC came with DirectX 4 I think. Man, has it been that long? Wow.

    Anyways, download the most recent SDK from microsoft. Also look at the sticky at the top of this board and you will see a post concerning basetsd.h. You need that file. It is for MSVC and it no longer comes with DX SDKs. It is in the Platform SDK with your compiler, so if you have the MSDN and extras that came with MSVC you should have basetsd.h. If not you can get it from the stick on this board.

    Microsoft is phasing out support for MSVC in hopes that everyone will rush out and buy MSVC .NET - which isn't happening, but they are hopeful.

  10. #10
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Thanx for all your help guys. Now it works
    Thankyou

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Isometric Tile Engine using DirectX
    By Wraithan in forum Game Programming
    Replies: 3
    Last Post: 07-17-2006, 12:16 PM
  2. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 06:16 PM
  3. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-24-2004, 11:49 PM
  4. DirectX 8 with Borland
    By Tommaso in forum Game Programming
    Replies: 11
    Last Post: 08-12-2003, 09:30 AM
  5. Directx SDK Documentation
    By Zoalord in forum Game Programming
    Replies: 4
    Last Post: 05-08-2003, 06:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21