Thread: header problem.

  1. #1
    Registered User
    Join Date
    May 2009

    header problem.

    So I have this project with bunch of headers included in core.h. main.cpp is included the core.h. Every header files included the core.h because the stdlib, directx headers and etc.

    Now I created a core class in core.h that has an object inside and shows errors

    error C2146: syntax error : missing ';' before identifier 'md2'

    #ifndef CORE_H
    #define CORE_H
    //Bunch of headers with the MD2Model.h
    class Core
      MD2Model md2;
    How can I fix this? I just want main.cpp to include one header file to use my engine.

    Thank you very much

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    The error message seems to suggest that MD2Model isn't recognized as a class name. So be sure the appropriate header appears before this declaration.

    If you're willing to deal with a large file, you can just preprocess the file and see what the compiler is seeing. (Assuming Visual Studio, you can go to project properties, C/C++, preprocessor.) This way you can see what happened with your headers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Compiling problem: "Invalid header in executable"
    By ckyle in forum C Programming
    Replies: 5
    Last Post: 02-28-2006, 02:00 AM
  3. Header file creation problem
    By ToxicLove in forum C Programming
    Replies: 2
    Last Post: 05-17-2004, 10:25 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Replies: 5
    Last Post: 12-03-2003, 05:47 PM