Thread: Installing Direct X

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    545

    Installing Direct X

    I am having a few problems installing Direct X, I have installed teh SDK, and then (I am using Code::Blocks) in code::blocks I have added the include and lib folders to my directory and then added d3d9.lib to the linkers.

    Switching to target: default
    Linking executable: C:\Documents and Settings\Mike The Magnificant\My Documents\Programming\Direct_X1.exe
    .objs\winmain.o:winmain.cpp.text+0x29e): undefined reference to `Direct3DCreate9@4'
    collect2: ld returned 1 exit status
    Process terminated with status 1 (0 minutes, 0 seconds)
    0 errors, 0 warnings
    That is the error I get when trying to build it.


    Any help is greatly appreciated.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    The import names might not be compatible with your compiler. Specifically if it is mingw tool, in which case you should use reimp: http://nexe.gamedev.net/directKnowle...Using%20DevCpp

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Will I want to reimp all of them? if so should I just do reimp -c *.lib?

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    This might also be of some interest to you.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I have realised that I have Visual C++ on my PC bt I much prefer Code Blocks, how do I get the reimp to work though as it said unrecognized command.

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I have found that reimp is in the MingW Utilites, do I need to download this or do I have it if I have the MingW compiler? If so how do I use the reimp function?

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You need mingw-utils - see the link in my post above for details.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Ok, I must be really stupid but I can't work out how to install the mingw-utils and then use the reimp.

    Any help is appreciated.

  9. #9
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Direct X is built around using Microsofts products, if you have MSVC++, then try using that instead if code::blocks. You WILL have to get the platform SDK installed if you are using MSVC++2005 express edition

  10. #10
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    As I say I would rather use Code::Blocks, so any help with the utilities would be greatly appreciated.

  11. #11
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You'll still need to install the directx sdk.

    It might be simpler for you if you install code::blocks nightly build and use the directx project template it provides. The project template will nag you for the path to the directx9 sdk; it seems to use ms headers and libs directly, too.

    If you still want to use reimp:

    1. Download mingw-utils-0.3.tar.gz and extract the archive into your mingw/bin directory.
    2. Copy the following fourteen files from the lib directory of your directx 9c installation directory into a separate directory:
      • d3d10.lib
      • d3d8.lib
      • d3d9.lib
      • d3dx10.lib
      • d3dx10d.lib
      • d3dx9.lib
      • d3dx9d.lib
      • d3dxof.lib
      • ddraw.lib
      • dinput.lib
      • dinput8.lib
      • dplayx.lib
      • dsetup.lib
      • ldsound.lib
    3. Then from the command line(cmd.exe), cd (change directory) to that temporary directory, and use reimp 'libname' on each individually, or just type the following commands in sequence, where path_to_your_mingw/bin_directory is, unsurprisingly, the path to your mingw/bin directory:
      Code:
      
      
      1. set path=path_to_your_mingw/bin_directory;%path%
      2. for %f in (*.lib) do reimp %f
      3. del *.obj
      4. del *.def
      5. move libd3dx9_30.a libd3dx9.a
      6. move libd3dx9d_30.a libd3dx9d.a
      Code:
      
      
      Or just use a batch file instead - create a plain text file, save it as convert.cmd and paste the following into it::
      Code:
      rem filename: convert.cmd
      set path=path_to_your_mingw/bin_directory;%path%
      for %%f in (*.lib) do reimp %%f
      rem the following are optional; omit if you want all of reimp's unmodified output
      del *.def
      del *.obj
      move libd3dx9_30.a libd3dx9.a
      move libd3dx9d_30.a libd3dx9d.a
      then run convert.cmd from a command prompt (cmd.exe) from the same directory you placed the libraries listed in part 2. above into.
    4. Copy the mingw libraries (*.a) to a subdirectory of your mingw/lib directory and give it a suitable name (no spaces) such as 'dx9c'.
    5. Add the 'include' path to the directx 9c sdk to your project's path(-I switch).
    6. Add the directory where you placed the mingw directx libs(*.a) to your project's library path (-L switch).
    7. Add the directory to the directx 9c sdk lib/x86 or lib/x64 directory depending on whether your target is a 32bit application (x86) or 64 bit(x64) with the -L switch; make sure this directory comes after the one set in the previous step.
    The ms libs not converted are static ones so just use them directly but use the actual name of the lib and not the more usual -l switch. The switches etc. above refer to use of mingw from the command line; code::blocks or dev-cpp or whatever ide you use will have some fancy gui for setting paths either globally or on a per project basis so you'll need to find and set them.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  12. #12
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Ok, I have tried adding MingW Utilities and it still doesn't say reimp is valid.

  13. #13
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    What exactly is 'it'? Help us to help you - please provide information with substance, not vacuous ambiguities.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  14. #14
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Well, I have tried extracting the Util to my MingW bin and then why I go to my CMD Prompt it tells me reimp is not a valied function. Would you be able to do the files for me? I know it is a big favour.

    Either that, or I learn to use Visual C++. Could somebody tell me how to set up Visual C++ Express for Direct X (I have already installed Direct X)

  15. #15
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Quote Originally Posted by bumfluff
    extracting the Util to my MingW bin and then why I go to my CMD Prompt it tells me reimp is not a valied function
    This is probably because reimp is not in the path when you run it from the command prompt; I have amended my description above to be more explicit in this respect so hopefully it should be easier to follow.
    Quote Originally Posted by bumfluff
    Would you be able to do the files for me? I know it is a big favour.
    No. The microsoft end user licence agreement (eula) seems clear that while it's okay for microsoft to distribute the directx sdk, it's not okay for others to do so, even if they distribute modified libs.

    This doesn't mean you can't modify these libs for your own personal use, nor does it imply additional restrictions in the distribution of any applications you make with those libraries.

    Quote Originally Posted by bumfluff
    I learn to use Visual C++
    I think this would definitely be the wisest course of action for you just now.
    Quote Originally Posted by bumfluff
    Could somebody tell me how to set up Visual C++ Express for Direct X (I have already installed Direct X)
    Tools menu --> Options, Projects and solutions, select VC++ directories and set the show directories for: combobox to 'include files'. Select the top entry in the listbox beneath the combobox, press 'ctrl + insert' to insert a new line(or use the buttons to add new line and move it to the top of the list) and add the directory to your directx sdk 'include' directory. Repeat with 'library files' selected in the combobox, setting the path to the 'lib\x86' (for 32bit builds) or 'lib\x64' (for 64 bit builds).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Direct Input shutting down improperly
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 06-14-2005, 06:54 AM
  2. Direct x 8 include files
    By Zoalord in forum Game Programming
    Replies: 2
    Last Post: 03-17-2004, 04:07 PM
  3. Direct X
    By MicroFiend in forum C++ Programming
    Replies: 2
    Last Post: 03-21-2003, 02:34 PM
  4. Direct Music Illegal Static Member Call error
    By FwyWice in forum Game Programming
    Replies: 4
    Last Post: 11-30-2002, 05:14 PM
  5. Direct Music Trouble
    By FwyWice in forum Game Programming
    Replies: 5
    Last Post: 11-29-2002, 04:01 PM