Thread: DX9 and Dev-C++

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    37

    Exclamation DX9 and Dev-C++

    Win2k pro, using Dev-C++.

    Urggghhhh! Well, I managed to find and download a DX9 package for Dev-C++. I also downloaded the DX9SDK.

    I configured my compiler correctly, I assume; I added the SDK and DX9 lib directories to the list; same with the Includes, I stuck 'em under C++ (using the Additional Directory option didn't work.)

    I also added -fvtable-thunks to my compiler additional command lines, since that seemed to kill about 30 more errors.

    However...I now have a VERY strange problem. I can't get any of the SDK samples working!

    The Samples\DInput\Mouse one gives me the following:

    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 7):mouse.cpp: undefined reference to `InitCommonControls@0'
    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 1412):mouse.cpp: undefined reference to `IID_IDirectInput8A'
    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 142c):mouse.cpp: undefined reference to `DirectInput8Create@20'
    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 145b):mouse.cpp: undefined reference to `GUID_SysMouse'
    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 148f):mouse.cpp: undefined reference to `c_dfDIMouse2'

    The Keyboard sample gives me about the same errors. The D3d\Lighting tutorial gives me:

    470 d:\dx9sdk\samples\c__~1\direct3d\lighting\lighting .cpp
    initialization to `TCHAR *' from `const char *' discards qualifiers.

    Heck, even the tutorial01 gives me the error: 152 d:\dx9sdk\samples\c__~1\direct3d\tutori~1\tut01_~1 \create~1.cpp
    ANSI C++ forbids implicit conversion from `void *' in argument passing.

    I'm convinced I'm doing something wrong here. Nothing seems to compile...does anyone have any suggestions as to what it might be?

    Oh, and, if anyone's looking for the DX9 package, it's available here:

    http://www.gametutorials.com/forum/t...?TOPIC_ID=4402

    --Ashiq

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Well, InitCommonControls() (I might know what is wrong)

    I don't like Dev-C++ using the Win32 API, because it's much more difficult, IMHO. But for InitCommonControls(), try including <commctrl.h> if you haven't already.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Are you sure you're linking all the files you need?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    37
    Erm, I tried including <commctrl.h>, but it didn't help..

    As for including all the proper files...I included all the header files and library files that I could find in the downloaded packages. And still it doesn't work....

    Has anyone else got DX9 working with Dev-C++?

    --Ashiq

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I used DX8...those errors still sound like linking errors (usually any error I see with something like "...@10" turns out to be linking prob) you could always try downloading the DX8 SDK, as it couldn't be too much different...i think
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    This is a linker error:

    C:\DOCUME~1\User\LOCALS~1\Temp\ccm6baaa.o(.text+0x 7):mouse.cpp: undefined reference to `InitCommonControls@0'
    try linking with the common controls library '-lcomctl32' (libcomctl32.a).

    As JaWiB has pointed out '..@10' type errors are linker errors so a library has not been properly linked - msdn will give you the ms name of the correct lib; mingw names are similar but with 'lib' as a prefix an .a as an extension.

    Some of the dx specific errors might arise because you have either failed to include the correct header or a preprocessor conditional has not been met. For the former check msdn for each function etc undeclared to see what header should be included. For the latter search through the specific header file for the relevant function and see whether you need to #define something first. (For example, you might want to try #define INITGUID before including any headers but i'm really not sure if that will help).

    eg. DirectInput8Create is declared in dinput.h, requires linking with dinput8.lib (translates to libdinput.a or '-ldinput' for MinGW) and take note of point 1. in the remarks section for that function:
    1. Set "#define DIRECTINPUT_VERSION 0x0800" before the include statement for Dinput8.h
    which might help (checking dinput.h as described above will show you why).

    ANSI C++ forbids implicit conversion from `void *' in argument passing/
    That requires casting - presumably the example you are using is a c-source file while you are attempting to compile c++.

    >> also added -fvtable-thunks <<

    This implies you are using an older version of mingw, if so get a more recent version:

    http://www.mingw.org/download.shtml

    (Alernatively you can download the most recent devcpp beta 5 [v4.9.8] which bundles with a recent mingw).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lights and .X files in c# using dx9
    By poopy_pants2 in forum Game Programming
    Replies: 2
    Last Post: 04-26-2004, 10:30 AM