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

  1. #1
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657

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

    See the error messages and the corresponding region yourself :
    An Unusual Error (pointing at a commented out region !!)-screenshot-2-png

    I thought the preprocessor eliminates the comments...Is there an exception for "int main()" ?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    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
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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..

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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..

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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 .

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  8. #8
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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 ?

  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  11. #11
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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.

  12. #12
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    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
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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 .

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, 05: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