Thread: Hai Friends i am getting one error

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    33

    Hai Friends i am getting one error

    Hai Friends,
    I am designing one module for Driver information, it contains so many module in two module i am getting following error in my Header file please can any one help me out please..
    Code:
    \src\fera_ci.h(93): error [34]: C statement or func-def in #include file, add i to the -r switch
    The error occured in following peace of code,

    Code:
    bool KEY__boPressed_Mode(void)          {return (PDI_boKeyMode);}

    can any one help me out i am very thankful to them
    Last edited by Salem; 08-16-2007 at 11:25 PM. Reason: code tags around only the code, not the whole post

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    did you add i to the -r switch?

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by robwhit View Post
    did you add i to the -r switch?
    Please can explain me what you mean by adding i to the -r Switch?
    don't mind please i am new to C programming

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    I have no idea. What compiler are you using?

    I'm guessing it's a compiler switch.

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by robwhit View Post
    I have no idea. What compiler are you using?

    I'm guessing it's a compiler switch.
    Thanks for your respondingm, well i am using VC++ ..can u give atleast some hint to fix this error... where i will get some more information regarding this.. which file i should check to fix it..please help me out this is very important for me.. thanks in advance

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It seems to me that you have code inside a header file.

    This is incompatible with the use of pre-compiled headers, which seems to be the default for Microsoft compilers.

    Something like
    Project->Settings->Compiler and turn off pre-compiled headers.

    Or better, just have
    bool KEY__boPressed_Mode(void);
    in the header file, and the function body in a single source file.

    Since the function in the header file was not static, you'd just end up with multiply defined errors in all the places where you included the file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by Salem View Post
    It seems to me that you have code inside a header file.

    This is incompatible with the use of pre-compiled headers, which seems to be the default for Microsoft compilers.

    Something like
    Project->Settings->Compiler and turn off pre-compiled headers.

    Or better, just have
    bool KEY__boPressed_Mode(void);
    in the header file, and the function body in a single source file.

    Since the function in the header file was not static, you'd just end up with multiply defined errors in all the places where you included the file.
    -- Very much thanks for you..i gets fixed it.. but one more new thing you discussed here
    like project->settings->compiler this path doesn't exit in my compiler..can you tell me where it may included so that i will turn off pre-compiled Headers..

  8. #8
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    what version of VC++ you are using?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  9. #9
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by vart View Post
    what version of VC++ you are using?
    I am using V3.x Version

  10. #10
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    that's like what, 1992 vintage?
    Isn't it time to upgrade to something a little more modern?

  11. #11
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by jwenting View Post
    that's like what, 1992 vintage?
    Isn't it time to upgrade to something a little more modern?
    It is 2007_07_13 vintage..

  12. #12
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Huh? I'm not sure you mean VC++ 3, check the version again. And what is x? That's like saying I have Linux X

  13. #13
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    Quote Originally Posted by zacs7 View Post
    Huh? I'm not sure you mean VC++ 3, check the version again. And what is x? That's like saying I have Linux X
    Is it correct --> I am using VC++ of this version 8.0.50727.42(RTM.050727_4200)?
    now can any one help to turn of pre_compiled headers, where is this option is defined
    earlier you suggested this path-->Project->Settings->Compiler and turn off pre-compiled headers
    but i checked this path, it is not existed in my compiler
    Last edited by Shidlingayya; 08-09-2007 at 07:31 AM.

  14. #14
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    That isn't VC++3, it's Visual Studio 2005, (version 8).
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  15. #15
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Project -> Properties -> Configuration Properties -> Precompiled Headers -> Create/Use Precompiled Headers
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

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. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  5. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM