Delphi XE shows at least 200 errors but the program compiles just fine
Asked Answered
U

6

12

My brand new Delphi XE shows hundreds of errors in 'Structure' panel. It shows errors like 'Undeclared FileExists at line 130' or 'Undeclared Create at line 242'. Even if it shows those errors, the program compiles just fine.

I also see that code insight is not always working. When I move the cursor over a variable, the cursor starts to flicker and no pop-up appears. Other times, it just highlight some units in red and it says the it cannot find them.

There are tricks to fix all these issues?


Update/Pseudo-fix:
I have found that restarting the IDE helps for a while.
I really help that one day Embarcadero will release Delphi ST (from STable).
:)

Unprecedented answered 20/5, 2011 at 20:20 Comment(7)
Also, the squiggly underlines in the Structure Pane and editor window is called Error Insight. If the squiggly lines bother you, you can turn off Error Insight in Tools|Options|Editor Options|Code Insight.Communalism
@Altar: Being flippant (smart-a**ed) to people you're asking for help won't get you answers. You know very well what I was saying, and your last comment won't help you at all. You didn't post any relevant code or provide any additional useful information, both of which I asked for in my first comment. Please improve your question, if you actually want help, or delete it if you don't.Communalism
I just ignore them. You could have asked the question better though. It took me ages to work out what you mean!Cutinize
I understood the question because it happens all the time and I already sent a message to QC about it - apparently it's simply a bug. So I just ignore it. It's too bad, because that could be a very useful panel if it was correctly implemented but, right now I don't keep it open because it's just a distraction. Hopefully Embarcedaro will fix it at some point without our having to shell out another $1300 for an 'upgrade' which amounts to nothing but bug fixes for stuff that their QC team missed or ignored. HTHTufthunter
Hi David. I have changed the question to say "It shows errors like..." instead of "Things like...". I hope this helps. I also hope one day they will fix at big bugs like this :)Unprecedented
This happens in XE, but to be honest - it also happens in D2007 as well (I have several installations on different VMWare disks, depending on the project i work on). I find it strange that older systems, like Delphi 7, have no problems in this area. It's really annoying.Treiber
Four years, and five versions of Delphi later and they still haven't fixed it. Does Embarcadero want customers? "Creating a development tool would be really fun if it wasn't for all these developers."Manicdepressive
M
9

Yeah, CodeInsight and ErrorInsight are known to have lots of problems. They've gotten a bit better each version for a while now, but there's still a lot to be done. Andreas Hausladen, who's probably the smartest guy in the Delphi community, has done a lot of poking around in the IDE internals, and he says they have race condition-based bugs that probably can't be fixed without a total rewrite.

If these fake errors are giving you trouble, you can probably disable them, as Ken mentioned in his comment.

Moshemoshell answered 20/5, 2011 at 21:25 Comment(5)
+1 for Turning them Off. What most people do when Error Insight goes nuts.Underpin
Did I really say that? (The "total rewrite" maybe, I say that a lot but never do it myself)Whit
@Andreas: Yeah, I remember pretty clearly you saying on the Emb forums somewhere that some of the ErrorInsight bugs (you specifically named the "TObject not found" thing) were caused by race conditions and couldn't be fixed without a total rewrite.Moshemoshell
Hi Mason. I am new to these new versions of Delphi (post Delphi 7). At the beginning I was impressed with the amount of new features they implemented/changed. But after just a bit of use, I have seen that quite few of them (like that nice 'background compilation') are totally flawed. I really hope Embarcadero will fix background compilation and CodeInsight/ErrorInsight one day as they could very useful.Unprecedented
+1 This "Horror Insight" broken feature is just to be disabled. It saves both CPU power and brain cells.Aboutship
H
4

For me it usually helps to close the project and re-open it; the structure errors disappear.

Haematoid answered 21/5, 2011 at 7:49 Comment(1)
Restarting the IDE is working for me but only for a while. At a moment ones must consider what is more productive: to restart the IDE in order to solve the issue or to totally disable the 'feature'.Unprecedented
L
2

It appears that much of the Error-Insight problems go away if you keep your library entries up to date.

This is was once pointed out by someone AGES ago on problem report for an earlier Delphi version and no-one seems to have picked up on it. If error-insight encounters a non-existent file in the LIBRARIES list it appears to just stop looking any further - leaving those annoying red-line squiggles everywhere! Trouble was, that problem report had so many entries everyone seems to keep missing that solution!

Go to Tools-Options and find the LIBRARY tab. Go through the lists and eliminate every entry that is ABSOLUTE but INVALID. You probably can and initially should leave any that have variables in them like $(BDSLIB) even if invalid, but definitely start by removing invalid ones that are declared without variables (which is what I mean by absolute). If you are gung-ho and just let Delphi auto-delete the invalid ones, all those with "unfulfilled" variables will disappear too - and that will break many things (this is another Delphi bug discussed elsewhere in this forum I believe). You may also have to repeat this with the Project-Options libraries, but be more circumspect here if the project came from someone else!

If that doesn't do the job immediately, then use the appropriate options tab to toggle the Error-Insight checkbox off and then back on again (closing the options dialog each time). That should get rid of any cached stuff, if such exists.

Deleting just some invalid entries worked for me on Delphi XE4.

Lauritz answered 7/8, 2013 at 12:34 Comment(0)
T
2

We noticed why problems occur. If there are some invalid invisible chars exist in code, this shows as error. These invalid chars sometime occurs when you copy some text and paste in delphi editor. Then, sometimes delphi paste text with invalid chars!

enter image description here

First you should copy all errored text and paste it on notepad++. enter image description here

You will see that all text you copied will not be pasted as well. You will see that corrupted text. You should look at code pasted, determine which code pasted as text. You should look which code could you see on notepad as pasted last char.

enter image description here

here we can see on picture captured: " RoutePatternObject); " so after these chars some invalid characters occur here but we can not see!

So we select these text area after " ; " character. Then delete and retype deleted codes again!

enter image description here

All red underline signatures will disappear!

enter image description here

Tiny answered 13/1, 2017 at 7:46 Comment(3)
Thank you so much this has helped me on an erroneous 'undeclared identifier' I was getting.Diphenyl
@NilsGuillermin, I am happy that I could help you.Alephnull
Yes. I confirm the same on my XE5. I had just pastes international characters and the IDE went haywire for this particular project. Even after removing those characters this persisted as the encodings I approved for a change (a dialog had asked me). Now I am looking for how to go back to "normal" encoding given those characters I do not need and have removed.Malnutrition
D
0

I have had the same errors before and i asked the same question, this was the reply: From another post:

You did not make a mistake. The problem is that the there are three compilers in XE2 (like in previous versions of Delphi): the real compiler (which works fine), the Code Insight compiler (which is faster), the Error Insight compiler (which must be even more faster), and the syntax highlighting parser (which is the fastest).

XE2 introduced a number of features that made the normal compiler slower, and gave the Code Insight and Error Insight compilers a bit of trouble. First of all, we have the new targets: Win32, Win64 and OSX which cause the search paths to be different for each target (see $PLATFORM directive), as well as build configuration, although there is only one "Library path" for each PLATFORM (and not for the build configurations).

The second complexing factor is the dotted unit names (scoped unit names) that were introduced. Windows is no longer Windows, but Winapi.Windows.

My guess is that these two additional complexing factors cause problems for the Code Insight and Error Insight compilers. Note that the real compiler still works. But the Error Insight shows incorrect errors, and the Code Insight doesn't always work for these units.

You could try to explicitly add them to the project again (in which case the full path will be used, like you mention in your question on stack overflow as well).

What I found out was:

  1. 99% of the errors are due to edited files not being save right (including references)
  2. If you add profiles Save your .dpr, .dproj, .pas, .dfm files (save unit, save project)
  3. If all fails a save + restart will usually fix it
  4. For older projects delete the .res file, it has botched paths, Delphi will recreate it.

(Sorry for the bad initial post, Just got a Stackoverflow account, was not allowed to edit it. I hope this will suffice)

Detwiler answered 26/12, 2012 at 13:16 Comment(0)
J
0

Copy and pasting the pas file into Notepad, clearing the pas file, saving, closing the IDE, opening the IDE then copying from notepad and pasting back to the pas file worked for me.

Joker answered 18/8, 2017 at 3:18 Comment(1)
BTW Using Delphi 2010Joker

© 2022 - 2024 — McMap. All rights reserved.