Linking DX9 lib? -,- (Mingw)

This is a discussion on Linking DX9 lib? -,- (Mingw) within the Tech Board forums, part of the Community Boards category; I looked around google and mingw's FAQs, but it doesnt seem to want to link. I've been trying this: Code: ...

  1. #1
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379

    Question Linking DX9 lib? -,- (Mingw)

    I looked around google and mingw's FAQs, but it doesnt seem to want to link.

    I've been trying this:

    Code:
    $ g++ C:\\Spacerpg.o -o C:\\Spacerpg.exe -mwindows -l C:\\DX9\\Lib\\x64\\d3d9.lib
    Code:
    $ g++ C:\\Spacerpg.o -o C:\\Spacerpg.exe -mwindows -L C:\\DX9\\Lib\\x64\\ -l d3d9.lib
    Code:
    $ g++ C:\\Spacerpg.o -o C:\\Spacerpg.exe -mwindows -llib C:\\DX9\\Lib\\x64\\d3d9.lib
    Code:
    $ g++ C:\\Spacerpg.o -o C:\\Spacerpg.exe -mwindows -L C:\\DX9\\Lib\\x64 -llib d3d9.lib
    None of them are compiling correctly, bah... >.<

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    None of them are compiling correctly
    What do you mean by correctly?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    You don't use double-backslashes on the command line. Use single ones.

    Other than that, if it is a linking problem, see if "C:\\DX9\\Lib\\x64\\d3d9.lib" exists.

    If you can't get it to work post the exact error message[s].
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Ah, I forgot to mention I'm using mingw & msys. It doesnt work right with single backslashs. I could use single forward slashs, but eh.

    The exact error is:
    Code:
    $ g++ C:\\Spacerpg.o -o C:\\Spacerpg.exe -mwindows -L C:\\DX9\\Lib\\x64 -l d3d9.lib
    C:\Mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -ld3d9.lib
    collect2: ld returned 1 exit status
    Its the same for all of them. And C:\DX9\Lib\x64\d3d9.lib does exist. (I installed it there.)

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    You have a mix of double-backslashes and single-backslashes there. That's probably not going to work.

    BTW, when you use -lname, GCC looks for libname.a in the library search paths (which you can add to with -L). I'm not sure how you handle .lib files; try just adding it on the command line like a C source file.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Okay, I found a thread on this: http://www.gamedev.net/community/for...10&gforum_id=0

    You can't use the .lib files with Dev-C++. You need to get the lib*.a files (which you use with -l). When I find where to get them I'll let you know.

    [edit] You could use MinGW. I don't know if this will work with Dev-C++ but I suspect it will: http://rpmfind.net/linux/RPM/sourcef....3-1.i586.html [/edit]

    [edit=2] A thread about the DirectX SDK for MinGW DevPAK: http://www.atomicmpc.com.au/forums.asp?s=2&c=10&t=3016 [/edit]

    [edit=3] Hmm, maybe you can use the .lib after all: http://www.spacejack.org/games/mingw/mingw-dx.html
    I'm going to stop searching now. Good luck. Let us know if it works. [/edit]
    Last edited by dwks; 09-16-2006 at 07:01 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    I tried method 2, I dont see how to install dev pack files?

    I also tried method 3
    Code:
    $ g++ C:\\Spacerpg.cpp -o C:\\Spacerpg.exe -mwindows -I C:\\DX9\\Lib\\x64\\d3d9.lib
    cc1plus.exe: C:/DX9/Lib/x64/d3d9.lib: not a directory
    Doesnt work, even though I'm sure its looking into the right spot. Seems like -I is specifying a folder location?

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You should create mingw compatible dx libs from the respective dlls using the reimp tool from mingw-utils; you can also use the ms directx libs themselves.

    For example (it's a while since I fiddled around with this so this may not be entirely accurate) copy the following ms directx libs to a separate directory:
    • d3d8.lib
    • d3d9.lib
    • d3dx8d.lib
    • d3dx9d.lib
    • d3dxof.lib
    • ddraw.lib
    • dinput.lib
    • dinput8.lib
    • dplayx.lib
    • dsetup.lib
    • dsound.lib
    • dxtrans.lib
    • ksproxy.lib
    • ksuser.lib
    • msdmo.lib
    • quatz.lib

    Then from the command line(cmd.exe), cd (change directory) to that temporary directory, and use reimp 'libname' on each individually, or just type:
    Code:
    for %f in (*.lib) do reimp %f
    to do them all together. Since these are non-standard mingw libs it would be advisable to create a new subdirectory of your mingw lib directory and copy all the libxxxx.a mingw compatible libraries you just created to it; when building directx applications you just have to ensure that subdirectory is in the library path (-L switch). Do the same with the ms directx headers; in this case you'd use the -I switch with the path to the dx9 'include' directory to ensure those files are in the include path for your mingw directx projects.

    Some of the ms dx libs contain statically linked code which needs to be built into your application. For these you have no choice but to link directly with them - just use the explicit full name of the required library rather than usual -llib_name syntax.

    You'll quickly find out which are which from the linker errors ('undefined reference' to function xxxx).

    Alternatively, you might want to consider using msvc-express which will be good to go once you've configured it to use the psdk and the dx9 sdk.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-16-2007, 12:02 PM
  2. MinGW Linking GUI Program
    By Tonto in forum Tech Board
    Replies: 19
    Last Post: 08-23-2006, 03:28 PM
  3. Info regarding multiply linking single static lib
    By lightatdawn in forum Windows Programming
    Replies: 2
    Last Post: 04-01-2005, 03:18 AM
  4. (quick and easy) lib linking question
    By cjschw in forum C++ Programming
    Replies: 4
    Last Post: 09-01-2004, 06:04 PM
  5. Convert Microsoft LIB to MingW compatible lib
    By tigs in forum Windows Programming
    Replies: 0
    Last Post: 07-20-2004, 06:53 PM

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