An Unusual Error (pointing at a commented out region !!)

This is a discussion on An Unusual Error (pointing at a commented out region !!) within the C++ Programming forums, part of the General Programming Boards category; See the error messages and the corresponding region yourself : I thought the preprocessor eliminates the comments...Is there an exception ...

  1. #1
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498

    An Unusual Error (pointing at a commented out region !!)

    See the error messages and the corresponding region yourself :
    Name:  Screenshot-2.png
Views: 88
Size:  188.0 KB

    I thought the preprocessor eliminates the comments...Is there an exception for "int main()" ?
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,266
    is it possible that code::blocks doesn't automatically save your files before building. you comment the code out, but the version that the compiler sees is the one with the code uncommented. I can see that the file has not been saved, so that's my best guess.

  3. #3
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    No, I'm sure it saves automatically..
    And the screenshot shows that because I probed around a little..scouring for the source of the error..
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  4. #4
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Anyway..I removed the "extra" int main()..and it works as it should...
    But this has got to be the strangest error I've ever seen....and probably would ever see..
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    The error message says line 5, and there is a little * next to the filename in the tab title.
    Did you save it before compiling?
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    line 5 : is in another file(matrix.cpp)...which has the current main() function....the commented portion was for testing the token.cpp file separately .
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    Still, it looks unsaved to me (the * thing I mentioned).
    If you're sure you have auto-save turned on, it might be worth checking C::B website / bug reports to see if there are any issues.
    If you can reliably replicate it, then submit a bug report to them.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    O ...sorry.. I found the problem..
    The token.cpp file was not from the current active project(It was #include'd but not added with C::B's gui )..so autosave did not work on it..It only saved the active files and started the compilation. Could absence of the configuration option to save all open files count as a bug ?
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    2,487
    No it is a design decision; not a bug.
    If you wish to waste your time, you can submit it as a bug and see it closed with no fix.

    Tim S.

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    One might question why you're #including .cpp files.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by Salem View Post
    One might question why you're #including .cpp files.
    because there isn't a way to add an external *.cpp to the compilation from the IDE without #include 'ing it.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  12. #12
    Registered User
    Join Date
    May 2010
    Posts
    2,680
    because there isn't a way to add an external *.cpp to the compilation from the IDE without #include 'ing it.
    What? Of course you can add files to your project. Select the Project menu item, then select Add Files.

    Jim

  13. #13
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by jimblumberg View Post
    can add files to your project
    True..but they were different projects (which are to be combined after everything works)..and I thought that adding a single file would lead to complexities....and I had some experiences where it messes with the makefile .
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looking for richly commented code.
    By nemuikuma in forum C Programming
    Replies: 15
    Last Post: 09-20-2010, 12:40 PM
  2. malloc error can't allocate region on mac os X
    By simone.marras in forum C Programming
    Replies: 6
    Last Post: 02-28-2009, 04:59 AM
  3. Copy region of bitmap to region of rectangle
    By Sfpiano in forum Windows Programming
    Replies: 2
    Last Post: 08-18-2007, 11:58 AM

Tags for this Thread


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