Thread: typedef enum question

  1. #1
    Registered User
    Join Date
    Apr 2003

    typedef enum question

    Just have a quick question, hopefully someone will be able
    to answer quickly.

    Trying to do something rather simple:

    typedef enum { FALSE, TRUE } fboolean;

    This works with the stand c header files.
    Why does it break when I include windows.h file?

    I get errors such as:

    (57): error C2143: syntax error : missing '}' before 'constant'
    Any help would be appreciated.

  2. #2
    King of the Internet Fahrenheit's Avatar
    Join Date
    Oct 2001
    Because windows.h defines FALSE as 0 and TRUE as 1, which means your enum statement is

    enum { 0, 1 }

    Either #undef both, or use different names.

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    It may even be a better plan to include windows.h and just use the internal definitions for TRUE and FALSE. While you're at it why not just use BOOL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. typedef question.
    By mikalv in forum C++ Programming
    Replies: 4
    Last Post: 06-24-2008, 02:11 AM
  3. Question about enum.
    By mewatC in forum C Programming
    Replies: 3
    Last Post: 01-16-2007, 04:15 AM
  4. Enum question
    By Bill 101 in forum C Programming
    Replies: 4
    Last Post: 10-31-2002, 12:33 AM
  5. enum question
    By incognito in forum C++ Programming
    Replies: 1
    Last Post: 12-30-2001, 12:04 AM