Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Strange

Strange

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studioperformancehelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Michael HaephratiM Offline
    Michael HaephratiM Offline
    Michael Haephrati
    wrote on last edited by
    #1

    Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain. The compilation errors were: *main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal main.cpp(323): this line contains a '{' which has not yet been matched main.cpp(326): fatal error C1075: end of file found before the left brace '{' at 'main.cpp(323)' was matched* But there was nothing wrong with my code. I counted all brackets and the number matched. There weren't any function inside another function. I solved it by removing all "//" comments from the source code. It seems that the reason for that is bad line formatting which causes the compiler to miss a line break, so the line after a comment is treated as a comment as well. For example:

    // This is a comment
    
    This\_is\_a\_line;
    

    is treated as:

    // This is a comment This\_is\_a\_line;
    

    There are many posts of the net about similar problems and some even suggested that they could be caused by a memory (RAM) fault on the machine, so before you replace your RAM, just remove the comments and see...

    - Michael Haephrati מיכאל האפרתי

    F S 2 Replies Last reply
    0
    • Michael HaephratiM Michael Haephrati

      Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain. The compilation errors were: *main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal main.cpp(323): this line contains a '{' which has not yet been matched main.cpp(326): fatal error C1075: end of file found before the left brace '{' at 'main.cpp(323)' was matched* But there was nothing wrong with my code. I counted all brackets and the number matched. There weren't any function inside another function. I solved it by removing all "//" comments from the source code. It seems that the reason for that is bad line formatting which causes the compiler to miss a line break, so the line after a comment is treated as a comment as well. For example:

      // This is a comment
      
      This\_is\_a\_line;
      

      is treated as:

      // This is a comment This\_is\_a\_line;
      

      There are many posts of the net about similar problems and some even suggested that they could be caused by a memory (RAM) fault on the machine, so before you replace your RAM, just remove the comments and see...

      - Michael Haephrati מיכאל האפרתי

      F Offline
      F Offline
      Freak30
      wrote on last edited by
      #2

      I assume this could be a codepage problem. There is an option under Tools/Options/Environment/Documents to save documents in Unicode. Maybe this has a side effect. Also if you (or someone else) edited the source file in some other editor that removed the carriage return from the line break, this could be a problem. I would open the source file in an editor that can show the specific line endings (e.g. Notepad2). Maybe you see something unusual there.

      The good thing about pessimism is, that you are always either right or pleasently surprised.

      Michael HaephratiM 1 Reply Last reply
      0
      • F Freak30

        I assume this could be a codepage problem. There is an option under Tools/Options/Environment/Documents to save documents in Unicode. Maybe this has a side effect. Also if you (or someone else) edited the source file in some other editor that removed the carriage return from the line break, this could be a problem. I would open the source file in an editor that can show the specific line endings (e.g. Notepad2). Maybe you see something unusual there.

        The good thing about pessimism is, that you are always either right or pleasently surprised.

        Michael HaephratiM Offline
        Michael HaephratiM Offline
        Michael Haephrati
        wrote on last edited by
        #3

        Thanks for the tips. I think one of the source files came from a Mac. Now when I place line breaks, get DEBUG messages, etc. it points to the wrong line and I don't know how to fix that.

        - Michael Haephrati מיכאל האפרתי

        1 Reply Last reply
        0
        • Michael HaephratiM Michael Haephrati

          Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain. The compilation errors were: *main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal main.cpp(323): this line contains a '{' which has not yet been matched main.cpp(326): fatal error C1075: end of file found before the left brace '{' at 'main.cpp(323)' was matched* But there was nothing wrong with my code. I counted all brackets and the number matched. There weren't any function inside another function. I solved it by removing all "//" comments from the source code. It seems that the reason for that is bad line formatting which causes the compiler to miss a line break, so the line after a comment is treated as a comment as well. For example:

          // This is a comment
          
          This\_is\_a\_line;
          

          is treated as:

          // This is a comment This\_is\_a\_line;
          

          There are many posts of the net about similar problems and some even suggested that they could be caused by a memory (RAM) fault on the machine, so before you replace your RAM, just remove the comments and see...

          - Michael Haephrati מיכאל האפרתי

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          Have you considered the possibility of a comment line containing a trigraph? See for example this article[^] on curious errors caused by accidental introduction of trigraphs in comment lines.

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups