Thread: I wrote a game in DirectX, but I keep getting these errors....

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    I wrote a game in DirectX, but I keep getting these errors....

    As the title suggests, I have recently written a game in DirectX, but I am havibng trouble. My code is fine and I don't get errors from my code, for some reason my compiler (MSVC++ 6) keeps on telling me that there is an error in excpt.h (which I did not include in my project) on line 36, so why am I getting these errors?? I did not write this header and I did not even include it in my project! What's going on here?

    Here are the errors:
    Code:
     c:\program files\microsoft visual studio\vc98\include\excpt.h(36) : error C2143: syntax error : missing ';' before 'string'
    
    c:\program files\microsoft visual studio\vc98\include\excpt.h(36) : fatal error C1004: unexpected end of file found
    Thanks for any help
    -Chris

  2. #2
    Unregistered
    Guest
    Check to see if you included any files that did include this header file. You might not have directly included it, but you might have another header file or something that uses this file.

  3. #3
    Unregistered
    Guest
    make sure you have a semi-colon after any class and struct declarations, those will cause that kind of error.

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    I checked them all and windows.h include that header file. I tried changing it so that it no longer includes it (after backing it up, ofcourse), but then found that it also includes another header which has the same problem. Here is the line of code which has the problem:
    Code:
    #ifdef  __cplusplus // line 35
    extern "C" } // line 36 - problem line
    #endif         // line 37
    If anybody can help at all, I would be greatly apprieciative.
    btw, the other affected header has the exact same 3 lines (there may be other affected headers)

  5. #5
    Hmmm...Do you need this header file? Can you use an alternative header or something, instead of this header file? It would make it a lot easier to use some different header.
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    an alternative to windows.h? do u know 1?

  7. #7
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    I think I know what's wrong.
    What are all the files you have and which includes are at the top of them?
    It's possible that you need an extra header file somewhere.

  8. #8
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    game.cpp -
    <windows.h>
    <windowsx.h>
    <mmsystem.h>
    <objbase.h>
    <iostream.h>
    <conio.h>
    <stdlib.h>
    <malloc.h>
    <memory.h>
    <string.h>
    <stdarg.h>
    <stdio.h>
    <math.h>
    <io.h>
    <fcntl.h>
    <ddraw.h>
    "Engine.h"


    Engine.h -
    [none]

  9. #9
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Are you doing anything in engine.h ?
    try including windows.h there or ddraw.h there and see if that takes care of it.

  10. #10
    Registered User Coder's Avatar
    Join Date
    Aug 2001
    Location
    Cairo, Egypt
    Posts
    128
    Since you're using VC++ (guess how I knew that ), check the project's external dependencies (a list of header files that are included by other headers).

    Errors posted by face_master
    c:\program files\microsoft visual studio\vc98\include\excpt.h(36) : error C2143: syntax error : missing ';' before 'string'
    c:\program files\microsoft visual studio\vc98\include\excpt.h(36) : fatal error C1004: unexpected end of file found
    Generally, when the compiler says : missing ';' before type (whatever type is) this possibly means that the compiler doesn't know what type is.
    I think the string class is part of the std namespace.
    The error could mean that someone using namespace std wasn't encountered by the compiler.
    I've had around 98 errors before when I included <iostream.h> and some other header file of the C++ streams. Try including <iostream> and defining using namespace std.

    Sorry if this doesn't help much.
    Muhammad Haggag

  11. #11
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Good point Coder.
    try
    <string>
    using namespace std;

    instead of
    <string.h>

  12. #12
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    I did that, but I still get errors in the following headers which arn't mine:

    excpt.h
    stdarg.h
    winbase.h
    winuser.h
    stdio.h

    Anybody got any ideas?

  13. #13
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    short of posting the code so we can play with it, I don't know.

  14. #14
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    the code is fully massive and is confusing if you don't look at it in small sections (eg. by looking at it function-by-function. Just tell me what part you want me to post and I will.

    Thanks

  15. #15
    Registered User Coder's Avatar
    Join Date
    Aug 2001
    Location
    Cairo, Egypt
    Posts
    128
    hmmmm, this is the kind of a problem that can't be solved like this. I don't know any predefined steps to solve this problem. If you're using MSVC, and you have no trouble sending me the whole project, mail it and I'll play with it a bit.

    Sorry, but I can't find another way.
    Muhammad Haggag

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New Project, text game, design stage.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 05-23-2007, 06:39 AM
  2. Game Designer vs Game Programmer
    By the dead tree in forum Game Programming
    Replies: 8
    Last Post: 04-28-2005, 09:17 PM
  3. 2D Game Project with DirectX and C++
    By VMJC in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 12-23-2004, 12:28 AM
  4. Wanna learn DirectX game programming
    By Hermitsky in forum Game Programming
    Replies: 2
    Last Post: 12-01-2004, 07:35 AM
  5. Check out this game I wrote
    By Eber Kain in forum Game Programming
    Replies: 4
    Last Post: 09-16-2003, 09:54 PM