Thread: DX error q?

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    DX error q?

    I got this error while compiling a simple DX program:
    Code:
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    Error: Unresolved external 'DirectDrawCreateEx' referenced from C:\COMP\DIRECTDRAWSPRITES.OBJ
    What does it mean, and how do I fix it? Thanks all !
    Do not make direct eye contact with me.

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    "Unresolved external" means its looking for a function (namely "DirectDrawCreateEx"), but it can't find it. If your #including the right directx files, make your your linking with the right object files.

    In VC++, I have to tell the compiler to use a folder that has lots of .o and .obj files for a library I downloaded. Yours probably does too, but I have no idea how.

    Most compilers that I know of keep all that stuff in the Lib folder, so possibly you could try putting the Lib files from directX into that?

    Although Salem might tell you off for messing with files in your compilers directory, so you could check the help files for your compiler on how to link with other files in folders. Hope that helps

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Ah, for DirectX, you need to be linking various .lib files.... first, check to make sure that the directX directory is included in the directories where MSVC looks for headers/libraries. If you had MSVC before you installed the DirectX SDK (you did that, right?), the DX SDK should have taken care of that for you. So, in project->settings->link->project options, add the following .libs (you don't need them all now, but you probably will in the future of your program)
    Code:
    dxguid.lib       //ummm...I forgot what this one was, but it's important
    comctl32.lib   //for common controls...not dx
    d3d9.lib        //for d3d
    d3dx9.lib     //for d3dx stuff
    dinput8.lib  //for direct input
    Away.

  4. #4
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Originally posted by confuted
    Ah, for DirectX, you need to be linking various .lib files.... first, check to make sure that the directX directory is included in the directories where MSVC looks for headers/libraries. If you had MSVC before you installed the DirectX SDK (you did that, right?), the DX SDK should have taken care of that for you. So, in project->settings->link->project options, add the following .libs (you don't need them all now, but you probably will in the future of your program)
    Code:
    dxguid.lib       //ummm...I forgot what this one was, but it's important
    comctl32.lib   //for common controls...not dx
    d3d9.lib        //for d3d
    d3dx9.lib     //for d3dx stuff
    dinput8.lib  //for direct input
    Just so you know, I'm using Borland. Anyway, to get it working, you have to create a bcc32.cfg file with the contents:
    Code:
    -I"D:\Compilers\Borland\Include"
    -L"D:\Compilers\Borland\Lib"
    Considering that's where Borland is. So would I add this to the end?
    Code:
    -I"D:\DXSDK\Include"
    -L"D:\DXSDK\Lib"
    And yes, I did install the DX SDK .
    Do not make direct eye contact with me.

  5. #5
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Looks good to me, did it work?

  6. #6
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Well, bcc32.cfg worked fine, but..... the real problem was with the turbo linker. It uses ilink32.cfg, which currently has this:

    Code:
    -L"D:\Compilers\Borland\Lib"
    I added the DX lib folder, so it now looks like this:
    Code:
    -L"D:\Compilers\Borland\Lib"
    -L"D:\DXSDK\Lib"
    Without the second lib declaration, the first error I had is created. With this new addition, here is what I get:

    Code:
    Borland C++ Compiler Blahblah
    ........
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    Fatal: Expected an option: LD:\DXSDK\Lib
    I get no errors from the actual compiler. Thanks all !

    EDIT:

    so bcc32.cfg has:
    Code:
    -I"D:\Compilers\Borland\Include"
    -L"D:\Compilers\Borland\Lib"
    -I"D:\DXSDK\Include"
    -L"D:\DXSDK\Lib"
    and ilink32.cfg has:
    Code:
    -L"D:\Compilers\Borland\Lib"
    -L"D:\DXSDK\Lib"
    Last edited by Lurker; 09-06-2003 at 11:18 PM.
    Do not make direct eye contact with me.

  7. #7
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    I'm really sorry to bump, but anyone haev a solution?? Thanks !
    Do not make direct eye contact with me.

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Try (includes path to psdk which you'll probably want anyway):
    bcc32.cfg
    -I"D:\Compilers\Borland\Include;D:\DXSDK\Include "
    -L"D:\Compilers\Borland\lib;D:\Compilers\Borland\li b\psdk;D:\DXSDK\lib"
    ilink32.cfg
    -L"D:\Compilers\Borland\lib;D:\Compilers\Borland\li b\psdk;D:\DXSDK\lib"
    edit: each -I and -L should be a complete line; the 'quote' appears to have wrapped it. Also, have a quick read of this faq, if you haven't already done so.
    Last edited by Ken Fitlike; 09-07-2003 at 03:56 PM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  9. #9
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    ARGHHH.

    -I"D:\Compilers\Borland\Include;D:\DXSDK\Include "
    -L"D:\Compilers\Borland\lib;D:\Compilers\Borland\li b\psdk;D:\DXSDK\lib"

    That is my bcc32.cfg file. ILINK32 is currently:
    -L"D:\Compilers\Borland\lib;D:\Compilers\Borland\li b\psdk;D:\DXSDK\Lib"

    What is wrong!!!!!! ARGHHH. Once again, I get "Unresolved External: DirectDrawCreateEx" . I don't get what is wrong! I've quadruple checked the locations, and I really dont get what is wrong! Sorry, but does ANYONE have a solution?
    Do not make direct eye contact with me.

  10. #10
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Once again, I am sorry to bump, but I am so close!!! Please, can you help? Thanks !!!
    Do not make direct eye contact with me.

  11. #11
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Migrate to another compiler/linker I know that with MSVC you can do a #pragma to link libs (my preferred method), or you can link them in the link tab under options.

    Also, to all those smarter people out there, (off topic) are #pragma's all compiler-specific or are only some? I never did really understand about that...

    **EDIT**
    Is the path you're using case sensitive? It usually doesn't matter, but I hate when I overlook something like that when it does matter.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  12. #12
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    No, the location is correct. And I think most pragmas are comp. specific. And im sticking with Borland
    Do not make direct eye contact with me.

  13. #13
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Maybe your SDK didn't come with the proper libs, or they are incomplete, or something got deleted/corrupted, etc. Have you tried reinstalling the SDK? Or maybe DirectDraw isn't included in the DX9 SDK? Who knows...
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  14. #14
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Well then what lib is it in . Ill see if I have it, I really want to start this. Thanks .
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DX or OpenGL?
    By michaelp in forum Game Programming
    Replies: 31
    Last Post: 01-10-2008, 06:26 PM
  2. Checking for DX in setup and deployment in MSVS 05 .NET
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-15-2006, 03:32 PM
  3. Assembly Tutorials
    By JoshR in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-11-2005, 09:56 AM
  4. Having some trouble setting up Dev-c++ for DX
    By Iamien in forum Game Programming
    Replies: 7
    Last Post: 08-25-2003, 07:30 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM