Thread: GCC bool undefined

  1. #1

    GCC bool undefined

    Currently,

    I'm using Redhat 9.0 with Kernel 2.4.20-31.9. Including GLIB 2.4, GLIBC 2.2 and GCC 3.2.2 20040222 (Red Hat Linux 3.2.2-5).

    Whenever I compile a file with gcc, the identifier bool seems to be undeclared. I have temporarily fixed this by adding typedef enum {FALSE, TRUE} bool; to my main source file, but I would like to know if there is a patch for GCC that might fix this in the future. Or if one or more of my previous versions of GCC, GLIB, are GLIBC or out-dated and may have something to do with this problem, please let me know.


    Thank you for your time,
    - 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.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    bool is a c++ type; use g++ or stick with your enum typedef if you want to use it with gcc.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Okay,

    Thanks for the tip. I'll keep this in mind.


    Thank you for your time,
    - 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.

  4. #4
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    you might think it is because vi automatically highlights it even in .c code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using Vectors. MinGW warning
    By Viewer in forum C++ Programming
    Replies: 9
    Last Post: 03-26-2009, 03:15 PM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  4. How to: Use OpenGL with Jgrasp
    By Pickels in forum Game Programming
    Replies: 3
    Last Post: 08-30-2005, 10:37 AM
  5. Undefined symbols from ld? ; making bundle; gcc 3.3
    By profxtjb in forum C Programming
    Replies: 5
    Last Post: 06-15-2004, 01:31 AM