strange errors

This is a discussion on strange errors within the C Programming forums, part of the General Programming Boards category; Hey guys, I was just trying out some exercises in this textbook I just got here " Programming in C ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    37

    strange errors

    Hey guys, I was just trying out some exercises in this textbook I just got here " Programming in C by Kochan." I use the compiler "Borland C++ BuilderX."
    While trying this simple program, the compiler gives me an error message that "_Bool" is an undefined symbol!!! This has to be crazy. Here's the code:

    Code:
    #include <stdio.h>
    
    int main(void)
    {
        int     integerVar = 100;
        float   floatingVar = 331.79;
        double  doubleVar = 8.44e+11;
        char    charVar = 'W';
    
        _Bool   boolVar = 0;
    
        printf("integerVar = %i\n", integerVar);
        printf("floatingVar = %f\n", floatingVar);
        printf("doubleVar = %e\n", doubleVar);
        printf("doubleVar = %g\n", doubleVar);
        printf("charVar = %c\n", charVar);
        getchar();
    
        return 0;
    }

  2. #2
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    bool is valid in C++, not in C..
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    hmmm, so kochan is the crazy one afterall... lol

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    One second ping. I just went through iso9899:1999(Programming Languages-C) also called C99 and it does define _Bool.
    Section 6.2.5 no.2 defines _Bool as an object large to store the values 0 and 1.so there must be something wrong somewhere!!!

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    well, i guess so, lol.. but, i dont understand how bool entered a C code !!
    C has only 5 data types.. void, char, int, double and long
    C++ has 2 more .. bool and wchar_t.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    i was speaking according to the c89 standard... i really dont know about the c99 standard..
    i really need to get a copy of the c99 standard..
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    Well, ping, even stranger things are happening bcos, wchar_t is featured in c99 as well. lol

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    hey, I downloaded it yesterday. I can send it to you. only 1.33Mb

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    Thanks Dave. Any suggestions of a good IDE I could use...

  10. #10
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    Try Dev CPP - then you should be able to use <stdbool.h> and the _Bool macro.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  2. Errors with header files in OpenGL using VisualC++
    By wile_spice in forum Game Programming
    Replies: 3
    Last Post: 06-22-2006, 08:56 AM
  3. strange errors?
    By egomaster69 in forum C Programming
    Replies: 6
    Last Post: 12-21-2004, 05:13 PM
  4. help with strange errors
    By rockdj in forum C++ Programming
    Replies: 4
    Last Post: 07-27-2004, 11:42 AM
  5. executing errors
    By s0ul2squeeze in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2002, 12:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21