Why Delphi says 'cannot resolve unit name xxx'?

前端 未结 5 540
南旧
南旧 2021-01-11 16:56

I\'m working with Delphi2010 Enterprise Update 4.
When I\'m opening my project in the IDE and displaying the mainform code, there are 2 unit names underline in r

相关标签:
5条回答
  • 2021-01-11 17:04

    Out of curiosity, is there any code in AdPort and/or AdStatLt that is subject to conditional compilation ?

    The parser that underpins Error Insight is I think different (physically and contextually) from the compiler. The compiler may be able to make sense of those conditional compilation areas that Error Insight is not.

    This is just speculation on my part, but Error Insight is much improved in Delphi 2010 and typically now only chokes when there are errors in my code that I have yet to resolve.

    0 讨论(0)
  • 2021-01-11 17:15

    I reset the library path under tools\options\environment options\delphi options\library.

    Click the dropdown box, and reselect your os, and it will reset the path to the library. Worked for me.

    0 讨论(0)
  • 2021-01-11 17:18

    Closing and reopening a project usually helps to get rid of most of these errors. Try it...

    (That doesn't change the fact that nowadays, this is probably my number one annoyance in the IDE...)

    0 讨论(0)
  • 2021-01-11 17:19

    Error Insight which keeps all the error messages into the structure view is quite buggy. It doesn't understand your code the way the compiler understands it.

    There is an IDE Fix Pack developed by Andreas Hausladen which reduces the number of those "Cannot resolve unit xyz" problems.

    It doesn't fix the bug, but it makes them less visible by addressing some of the Error Insight's threading problems.

    0 讨论(0)
  • 2021-01-11 17:20

    Just disable Error Insight (Tools -> Options -> Editor Options -> Code Insight, uncheck Error Insight). It works fine for me.

    Source: http://codeverge.com/embarcadero.delphi.ide/cannot-resolve-unit-name-forms/1041789

    This is a cosmetic issue only, and doesn't affect your application in any way.

    It's caused by a bug in the compiler used for Error Insight (the functionality that gives you the wavy red lines), which is not the same compiler used to build your application or to compile from the command line. The bug has existed since Error Insight was first introduced. (It has gotten less frequent, though; it used to be that the first thing I would do when I installed Delphi was to disable Error Insight, and I haven't had to do that with either D2007 or D2009 as the problem is very infrequent and do esn't seem to last long for whatever reason.)

    Since there really isn't a problem (other than the cosmetic issue), you can either ignore it or get rid of it by disabling Error Insight (Tools -> Options -> Editor Options -> Code Insight, uncheck Error Insight).

    0 讨论(0)
提交回复
热议问题