Thread: DirectX SDK Error, annoyance

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    4

    DirectX SDK Error, annoyance

    When i'm trying to compile a program in C++ I keep getting an error:

    at the line

    #include "dxfile.h" // defines LPDIRECTXFILEDATA

    and the debugger says:

    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Documents and Settings\Haxxor\Desktop\D3Dintro\D3DIntro.cpp" -o "C:\Documents and Settings\Haxxor\Desktop\D3Dintro\D3DIntro.exe" -g3 -I"D:\Dev-Cpp\include\c++" -I"D:\Dev-Cpp\include\c++\mingw32" -I"D:\Dev-Cpp\include\c++\backward" -I"D:\Dev-Cpp\include" -I"C:\DX90SDK\Include" -I"C:\DX90SDK\Samples\C++\Common" -I"C:\DX90SDK\Include\DShowIDL" -I"D:\Dev-Cpp\include" -L"D:\Dev-Cpp\lib" -L"C:\DX90SDK\Lib"
    In file included from C:/DX90SDK/Include/d3dx9mesh.h:15,
    from C:/DX90SDK/Include/d3dx9.h:47,

    from C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:32:
    C:/DX90SDK/Include/dxfile.h:240: stray '\32' in program

    In file included from C:/DX90SDK/Include/d3dx9mesh.h:15,
    from C:/DX90SDK/Include/d3dx9.h:47,

    from C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:32:
    C:/DX90SDK/Include/dxfile.h:240:2: warning: no newline at end of file
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp: In function
    `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:141: warning: passing

    NULL used for non-pointer argument passing 1 of `HWND__*
    CreateWindowExA(long unsigned int, const CHAR*, const CHAR*, long unsigned
    int, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:141: warning: argument
    to non-pointer type `long unsigned int' from NULL
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:163: warning: passing
    NULL used for non-pointer argument passing 3 of `BOOL PeekMessageA(tagMSG*,
    HWND__*, unsigned int, unsigned int, unsigned int)'
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:163: warning: argument
    to non-pointer type `unsigned int' from NULL
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:163: warning: passing

    NULL used for non-pointer argument passing 4 of `BOOL PeekMessageA(tagMSG*,
    HWND__*, unsigned int, unsigned int, unsigned int)'
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:163: warning: argument

    to non-pointer type `unsigned int' from NULL
    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:185: invalid

    conversion from `void*' to `HINSTANCE__*'

    C:/Documents and Settings/Haxxor/Desktop/D3Dintro/D3DIntro.cpp:371:35: warning: no newline at end of file

    Execution terminated


    Do you have any idea?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Generally if you get a warning like "invalid conversion from 'x' to 'y' " then you are probably compiling something as c++ that might otherwise compile ok as C; in short, cast to the required type which is being complained about (eg. void* to HINSTANCE requires an explicit type cast to HINSTANCE).

    The newline at end of file warning is common with gcc (g++); apparently it's now standard to have a newline at the end of each file so get into the habit of adding one to eliminate that annoying warning.

    NULL is good for pointers only, not numbers, hence " NULL used for non-pointer argument". Zero works for numbers and pointers so, to avoid this hassle, just use zero for both ie zero for NULL pointer and as the numeral itself. If you prefer to continue to use NULL then remember to use it only with pointers.

    "stray '\32' in program" - don't have a clue; that's a new one on me. However the compiler, as with all such errors\warnings, usually explicitly tells you where the problem occurs. So open up 'dxfile.h' and take a close look at (and possibly around) line 240 to see what the problem is.

    Hope that helps some.
    Last edited by Ken Fitlike; 10-11-2003 at 09:09 AM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Sounds like the compiler does not recognize most of the declarations in the header file. This will produce oodles and oodle of warnings. Check to make sure that the header file is compatible with your compiler.

  4. #4
    Registered User
    Join Date
    Oct 2003
    Posts
    4

    DirectX SDK Error, annoyance

    I switch to MSV C++ 6.0 and tried #include <ddraw.h> and this showed up:

    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/DDrawtut.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    DDrawtut.exe - 2 error(s), 0 warning(s)

    help this is really annoying me, why isn't the SDK working correctly!

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Are you linking the correct libraries?
    Did you create a windows project, or a console app? (should be former)
    Away.

  6. #6
    Registered User
    Join Date
    Oct 2003
    Posts
    4

    DirectX SDK Error, annoyance

    Win32 project i'm pretty sure.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  2. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  3. Directx SDK Documentation
    By Zoalord in forum Game Programming
    Replies: 4
    Last Post: 05-08-2003, 06:07 AM
  4. DirectX SDK and ActiveX SDK
    By moemen ahmed in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-30-2002, 04:16 AM
  5. DirectX SDK
    By c++_n00b in forum Game Programming
    Replies: 6
    Last Post: 04-04-2002, 12:39 PM