How To Fix This error

Discussion in 'C' started by lieweffect, Apr 21, 2006.

  1. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    I have compile a program, below is a part of the code:
    typedef enum{false,true}boolean;
    But after compile it give me the following error

    expected identifier before "false"
    expected "}" before "false"
    expected unqualified-id before "false"
    expected ',' or ';' before "false"
    expected declaration before "}" token.


    I'm using the Dev-C++ to compile
    Can anybody help me.Thank You
     
    Last edited: Apr 21, 2006
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    typedef enum{false,true}boolean; means you are assigning value 0 to the false and 1 to true but it might so happen that its predefined for the compiler.
     
  3. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    Then how do I fix it?
    Thank You
    I attached together with the code.
    If possible could you fix it and make an execute program to me
    Thank You
     

    Attached Files:

    • code.txt
      File size:
      13.3 KB
      Views:
      886
  4. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    Just try replacing it with typedef enum{_false_,_true_}_boolean_; and see if it compiles or there are some more errors somewhere else.
     
  5. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    cannot, after replace the code, there have lot of errors
     
    Last edited: Apr 21, 2006
  6. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    What are the errors coming.
     
  7. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    I have upload the code.You try to have a look
     
  8. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    I use VC++ compiler and it does not support lots of functions. like clrscr,gotoxy but after removing them and replacing the boolean with the necessary code I succesfully compiled it.
     
  9. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    Could you make an exe. file and send the code together to me.Thank You
    My e-mail: lieweffect@yahoo.com
     
  10. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    GMail does not allow me to upload exe files and I have renamed it to g4e file. Please rename it to exe file.
     
  11. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    Maybe you can zip all the files together.
     
  12. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    It did not allow the exe file inside the zip and so I renamed it.
     
  13. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    OK, I try to rename after received
    Thank You
     
  14. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    After I renamed it run the program, I can only see the word "SCHOOL OF COMPUTING" and cannot do anything
     
    Last edited: Apr 21, 2006
  15. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    Thats because probably I have removed the clrscr and gotoxy. You probably need the bloodshed compiler to compile the program.
     
  16. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    So, can it run on your system? If I'm use VC++ to compile, can I run the program properly?
     
  17. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I have compiled the program and emailed you.
     
  18. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    Thank You.The program can run now.
    Could you send the source code to me and tell me which compiler you use.
    I need to modify the password and something.
    Thank You
     
    Last edited: Apr 22, 2006
  19. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The source code is same as you provided without any editing done on it. I have used TurboC3
     
  20. lieweffect

    lieweffect New Member

    Joined:
    Apr 20, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    I use turboC3 to compile there still have error.
    Sorry for disturb you again
    Can you please help me to compile with this one
    Thank You
     
    Last edited by a moderator: Apr 22, 2006

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice