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. Project compiles but VS IDE shows red error lines

Project compiles but VS IDE shows red error lines

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiohelpquestion
6 Posts 4 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.
  • A Offline
    A Offline
    AmbiguousName
    wrote on last edited by
    #1

    Hello there. I have this project which compiles fine but VS IDE shows that it can not find identifier. Under these identifiers are red lines. WHY is it so ??? Is there some setting I need to check??

    This world is going to explode due to international politics, SOON.

    S L 2 Replies Last reply
    0
    • A AmbiguousName

      Hello there. I have this project which compiles fine but VS IDE shows that it can not find identifier. Under these identifiers are red lines. WHY is it so ??? Is there some setting I need to check??

      This world is going to explode due to international politics, SOON.

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

      It is only the VS tool Intellisense that produces the red lines. Intellisense is not as clever as the compiler, so it may have trouble identifying some symbols. This is less of an issue in newer versions of VS (you didn't say which version you have), but it can still happen in code that requires multiple passes to interpret, e. g. code involving #define macros and/or templates.

      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)

      A 1 Reply Last reply
      0
      • A AmbiguousName

        Hello there. I have this project which compiles fine but VS IDE shows that it can not find identifier. Under these identifiers are red lines. WHY is it so ??? Is there some setting I need to check??

        This world is going to explode due to international politics, SOON.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It dependes on the identifier, where in the code it occurs, and what results you get from the build. Without more information it's difficult to make any other comments.

        1 Reply Last reply
        0
        • S Stefan_Lang

          It is only the VS tool Intellisense that produces the red lines. Intellisense is not as clever as the compiler, so it may have trouble identifying some symbols. This is less of an issue in newer versions of VS (you didn't say which version you have), but it can still happen in code that requires multiple passes to interpret, e. g. code involving #define macros and/or templates.

          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)

          A Offline
          A Offline
          AmbiguousName
          wrote on last edited by
          #4

          I am using VS Ultimate 2013.

          Stefan_Lang wrote:

          but it can still happen in code that requires multiple passes to interpret

          Did you mean compile ? If not, what do you mean by multiple passes to interpret ??

          This world is going to explode due to international politics, SOON.

          S J 2 Replies Last reply
          0
          • A AmbiguousName

            I am using VS Ultimate 2013.

            Stefan_Lang wrote:

            but it can still happen in code that requires multiple passes to interpret

            Did you mean compile ? If not, what do you mean by multiple passes to interpret ??

            This world is going to explode due to international politics, SOON.

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

            I meant interpret in the sense to figure out what a line of code means. Maybe analyze is a better term. Both the compiler and Intellisense need to do this, although for the compiler that's just an intermediate step. E. g. in a first pass, all preprocessor commands are interpreted, such as #include, #define, and #pragma. After that, most of the code should be plain C/C++, except template definitions: template code is not complete until you specify the template arguments, and that may only happen much later in the code, or, possibly, not at all in the current compilation unit. The purpose of Intellisense (or one of its purposes) is to give you instant feedback on the correctness of code as you type. But it can't give you that feedback for code that requires other code from an entirely different part of the solution.

            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
            • A AmbiguousName

              I am using VS Ultimate 2013.

              Stefan_Lang wrote:

              but it can still happen in code that requires multiple passes to interpret

              Did you mean compile ? If not, what do you mean by multiple passes to interpret ??

              This world is going to explode due to international politics, SOON.

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #6

              The underlining is done by the editor which is part of the IDE. It parses the source files and tries to find the definitions of variables, functions etc., in the source file itself and the included files. Stefan called this process "interpretation". The parser (the part of the IDE that does this job) is not a compiler. But it is somewhat similar to a compiler by performing identical or similar tasks to check the source code. A compiler processes his input files not in one go but uses multiple "passes". The parser might not do this or might not perform always similar to a compiler. This may then lead to the behaviour you are seeing.

              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