Thread: errors using my parser- MSVC++ 6, bhtypes.h

  1. #1
    Registered User AeroHammer's Avatar
    Join Date
    Sep 2002
    Posts
    12

    Post errors using my parser- MSVC++ 6, bhtypes.h

    Every time I try to include my parser class's header file, I get the following errors:

    c:\program files\microsoft visual studio\vc98\include\bhtypes.h(19) : error C2146: syntax error : missing ';' before identifier 'UNALIGNED'
    c:\program files\microsoft visual studio\vc98\include\bhtypes.h(19) : fatal error C1004: unexpected end of file found
    I get the errors every time I try to compile the file with the main() function. These are the includes:

    Code:
    	 /* Headers for the default libraries */
    #include <fstream.h> /* Defines files streams */
    
    	/* Headers for my modules */
    #include "commands.h" /* defines the commands for the parser */
    #include "FileCore.h" /* Handles opening and closing of files */
    #include "RGB_Data.h" /* Defines the rgb data class, requires istream and ostream classes */
    #include "BumpMaps.h" /* Defines the BumpMaps class for image storage, requires the rgb class */
    #include "RGB_Operations.h" /* Defines the BMP_Operations class for image editing, requires the rgb class */
    
    #include "parser.h" /* My general parser */
    When I comment out the parser.h include, the errors go away. I need to know how to deal with this. As I don't include the bhtypes file myself, I can't remove the include. How do I deal with this? Is there a simple way, or will I need to stick another class between the main and the parser?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Re:

    I have encountered the exact same error:

    c:\program files\microsoft visual studio\vc98\include\bhtypes.h(19) : error C2146: syntax error : missing ';' before identifier 'UNALIGNED'
    ... when compiling a parser that I am adapting from another code. It is definately the parser that is triggering the error.

    My gut feeling tells me it's related to line 30 of the file, but I'm not sure:

    typedef struct _PARSER *HPARSER;
    Have you had any luck in finding a solution since you initially made your post?

    Regards,

    c-coder

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Hmm...I hope the OP has, since it was 1 1/2 years ago. Nice bump on a dead thread.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Re:

    Hi,

    I knew the thread was started about a year and a half ago but the fact remains that I am actively looking for a solution to the error. To date I have found very little information about the cause of the error and I might as well try my luck here despite the slim odds of a reply.

    Cheers!

  5. #5
    Hello,

    For example: error C2146: syntax error : missing ';' before ‘cin’. The arrow may be pointing at a faultless line beginning with ‘cin’. But the previous line, perhaps a cout statement providing on-screen instructions to a program user, is missing at least its mandatory semi-colon termination.

    Or perhaps more—it might even be missing an entire intended stream modifier such as ‘<< endl;’. Remember that an error message only points out a syntax error. You may have left out more than the compiler can point out!

    All C++ statements must end with a semicolon. Therefore, the first error can be fixed by placing a semicolon (;) at the end of the previous line, in most cases.


    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    536
    Quote Originally Posted by AeroHammer
    Every time I try to include my parser class's header file, I get the following errors:



    I get the errors every time I try to compile the file with the main() function. These are the includes:

    Code:
         /* Headers for the default libraries */
    #include <fstream.h> /* Defines files streams */
    
        /* Headers for my modules */
    #include "commands.h" /* defines the commands for the parser */
    #include "FileCore.h" /* Handles opening and closing of files */
    #include "RGB_Data.h" /* Defines the rgb data class, requires istream and ostream classes */
    #include "BumpMaps.h" /* Defines the BumpMaps class for image storage, requires the rgb class */
    #include "RGB_Operations.h" /* Defines the BMP_Operations class for image editing, requires the rgb class */
    
    #include "parser.h" /* My general parser */
    When I comment out the parser.h include, the errors go away. I need to know how to deal with this. As I don't include the bhtypes file myself, I can't remove the include. How do I deal with this? Is there a simple way, or will I need to stick another class between the main and the parser?

    It looks to me like it is picking up the parser.h file in the Visual Studio vc98\include directory. This includes the file bhtypes.h, which is giving the error (If you really want to use bhtypes.h, you should include bh.h and it will define everything that bhtypes.h needs before including it.)

    If you have your own parser.h, try this:
    Just for kicks, rename your parser.h to something else, include this in your program, and see if the errors change.

    Of course if you use " " in your #include instead of < > it should look in your current directory before the system include directory, but sometimes ...

    Regards,

    Dave
    Last edited by Dave Evans; 01-25-2005 at 06:46 PM.

  7. #7
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > the slim odds of a reply.

    The odds just decreased.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Header File Errors...
    By Junior89 in forum C++ Programming
    Replies: 5
    Last Post: 07-08-2007, 12:28 AM
  2. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  3. MSVC 6 SP5 template errors
    By jdinger in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2003, 09:59 AM
  4. errors in class(urgent )
    By ayesha in forum C++ Programming
    Replies: 1
    Last Post: 11-10-2001, 10:14 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM