Why are there errors in my structure viewer pane but not when I compile?
Asked Answered
Z

2

2

I build my project, and there are no errors:

enter image description here

That's because the build succeeded without any errors:

enter image description here

This is a good thing. The application runs and everything!

Except there are errors

What the compiler doesn't tell me is that there are errors:

enter image description here

I just happened to have this file open. And i just happened to have the Structure viewer open. And i just happened to see the errors.

Is there a way for Delphi to report all error it encounters during a build?

Is optimization on?

No

enter image description here

It's no big deal for a simple one-form test application, with one error. But when i have 200 forms, XE6 starts to look as bad a Visual Studio 2012. I then have to be sure to manually open every code file and check if there are any errors in it.

enter image description here

Is there a way to get XE6 to report all errors?

#xe6usability

Zachary answered 14/8, 2014 at 15:23 Comment(3)
As others have said: The compiler is right, but the IDE is sometimes wrong. This seems to stem from the fact that Error Insight uses its own simplified compiler (which probably cuts some corners and not always correctly) which seems to have problems reading identifiers from certain units. I usually disable Error Insight.Kielce
This problem has been known about inside the Delphi team for years, and the solution is a unified code-insight, error-insight, sharing a single parser with the compiler and all other tools that require a parser. Maybe this will appear in some future Delphi compiler/IDE release.Irreproachable
possible duplicate of Delphi XE shows at least 200 errors but the program compiles just fineMarcheshvan
J
3

The compiler is correct. Your code does not contain an error. You have two functions with the same name, but declared with the overload directive.

The IDE's Code Insight, or Error Insight, or whatever the feature is called, is mis-reporting this as an error. This is an age old phenomenon. The IDE uses a different code parser from the real compiler. Indeed, if I recall correctly, it uses multiple such fake parsers. They are not as good as the real one, and not infrequently get things like this wrong. It's considered to be a minor inconvenience and that's probably reasonable. I'd much rather the real compiler got it right than the other way around.

Jamison answered 14/8, 2014 at 15:30 Comment(4)
One main reason I've never bothered with the Structure Viewer. I honestly don't understand why it's there.Reservation
@DavidSchwartz I used the structure view all the time. But that was before it started to show errors. Now that it shows erroneous errors it will be less useful.Zachary
I still use the structure view. But I disable Error Insight. The structure and the Error Insight are displayed in the same pane, but they are different things.Kielce
@DavidSchwartz: The Structure Viewer is there because it's extremely useful (and is almost required to use in FMX applications to establish parentage). You can either turn off Error Insight to eliminate the majority (if not all) of the errors being displayed, or add the appropriate units to your project (Project->Add to Project), which will properly allow the kibitz compiler (the "fake compiler" to which David refers) to resolve things.Voltmer
I
2

Short answer: Turn off ErrorInsight, it doesn't work.

Click Tools, Options, Find Editor Options item in the list, expand it, find Code Insight, click it. Then unclick Error insight.

enter image description here

Irreproachable answered 14/8, 2014 at 17:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.