Delphi XE2后台IDE编译器找不到源路径 [英] Delphi XE2 background IDE compiler unable to find source path

查看:25
本文介绍了Delphi XE2后台IDE编译器找不到源路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚买了 XE2 版本,安装了 update 1 ISO,并用它编译了我的开源项目.p>

事实上:

  • 我将库的源代码路径添加到通用设置 IDE(适用于我使用的所有平台,即 Windows 32 位和 64 位至今);
  • 我编译了我们框架的 TestSQLite3.dpr 回归测试 - 没问题:EXE 已编译并且所有测试都通过了;
  • 我对 IDE 后台编译器有一个奇怪的问题:即使项目已编译,IDE 也会显示一些关于未知文件的错误(不是在底部编译器消息中,而是在类导航树的顶部 - 左侧源代码编辑器),在 .dpr 源代码中,单元名称带有红色下划线,我无法在源代码中导航(使用 Ctrl+单击符号).

我已将库的源代码路径添加到项目选项中(对于 Win32/Win64 - 即使它已在全局 IDE 级别设置).现在关于未知文件的错误消失了,但源代码中单元名称仍然是红色下划线,Ctrl+Click不起作用.

TestSQLite3.dpr源代码没有指定单位的完整路径:

使用{$I SynDprUses.inc}视窗,留言,系统工具,类,同步加密,SynCrtSock,同步公共,同步数据库,SynOleDB,SynDBOracle,(...)

在上述行中,SynCrypto、SynCrtSock、SynCommons 用红色下划线标出.

我的实际猜测是 .dpr 中需要完整路径(SynCrypto in '..SynCrypto.pas').我没有对此进行测试,因为我没有 XE2 在工作.

由于以前的 IDE 使用这种源代码没有问题(从 Delphi 6 到 XE 都可以使用),我想知道是否存在回归的可能性,或者以前版本的新选项不可用我没有正确设置的IDE(可能是基于平台的).或者,现在 .dpr 中可能需要完整路径 - 但这对我来说听起来像是 Code/Error Insight 编译器中的回归.

解决方案

我向 Dr Bob 提出了这个问题(我通过他购买了 XE2 许可证 - 因为 1 $ = 1 € 等式听起来有点不公平,我希望至少有一位真正的 Delphi 专家作为我的经销商).

这是他的回答:

<块引用>

你没有犯错.问题是有三个XE2 中的编译器(就像以前的 Delphi 版本一样):真正的编译器(工作正常),代码洞察编译器(这是更快),Error Insight 编译器(必须更快),和语法高亮解析器(这是最快的).

XE2 引入了许多功能,使普通编译器速度较慢,并为 Code Insight 和 Error Insight 编译器提供了一些麻烦.首先,我们有了新的目标:Win32、Win64 和 OSX这会导致每个目标的搜索路径不同(请参阅$PLATFORM 指令),以及构建配置,虽然有每个平台只有一个库路径"(而不是构建配置).

第二个复杂因素是带点的单元名称(作用域单元名称)被介绍.Windows 不再是 Windows,而是Winapi.Windows.

我的猜测是这两个额外的复杂因素导致Code Insight 和 Error Insight 编译器的问题.注意真正的编译器仍然有效.但错误洞察显示不正确错误,并且 Code Insight 并不总是适用于这些单元.

您可以尝试再次将它们显式添加到项目中(其中情况下将使用完整路径,就像您在问题中提到的那样堆栈溢出).

所以我担心这是一些回归......

在结束问题时

第一点是添加完整路径:

 SynPdf in '..SynPdf.pas',

在 .dpr 中确实让文件被找到了——但后台编译器仍然丢失,无法在这个主体中找到类声明.

只是另一个回归样本:

 var Thread: array[0..3] of integer;句柄:整数数组[0..high(Thread)];

是一种完全安全的语法,编译得很好,由以前的 Error Insight 编译器解释没有任何问题(从 Delphi 5 开始工作),但在 XE2 下失败.

我对 XE2 IDE 有点失望.编译器使它工作.但是IDE真的很让人失望.从我的角度来看,它不可用.我将继续使用 Delphi 7 作为我的主编辑器,并且只使用 XE2 作为跨平台编译器和调试器.

I just bought XE2 version, installed the update 1 ISO, and made my Open Source projects compile with it.

In fact:

  • I added the source code paths of the library to the general settings IDE (for all platforms I use, i.e. Windows 32 bit and 64 bit up to now);
  • I compiled the TestSQLite3.dpr regression tests of our framework - no problem: EXE is compiled and all tests passed;
  • I've a strange issue with the IDE background compilers: even if the project compiled, the IDE displays some errors about unknown files (not in the bottom compiler messages, but in the top of the classes navigation tree - left to the source code editor), and in the .dpr source code, the unit names are underlined in red, and I'm not able to navigate inside the source (using Ctrl+Click on a symbol).

I've added the source code paths of the library to the project options (for Win32/Win64 - even if it was already set at the global IDE level). Now the errors about unknown files disappeared, but the unit names are still underlined in red in the source code, and the Ctrl+Click does not work.

The TestSQLite3.dpr source code do not specify the full path of the units:

uses
  {$I SynDprUses.inc}
  Windows,
  Messages,
  SysUtils,
  Classes,
  SynCrypto,
  SynCrtSock,
  SynCommons,
  SynDB,
  SynOleDB,
  SynDBOracle,
  (...)

In the above lines, SynCrypto, SynCrtSock, SynCommons are underlined in red.

My actual guess is that full paths are needed in the .dpr (SynCrypto in '..SynCrypto.pas'). I did not test this because I don't have XE2 at work.

Since there was no issue with the previous IDE with this kind of source code (it worked from Delphi 6 up to XE), I wonder if there is a possibility of regression, or a new option not available with the previous version of the IDE (probably platform-based) which I did not set properly. Or perhaps the full path is now needed in .dpr - but this sounds like a regression in the Code/Error Insight compiler to me.

解决方案

I asked the question to Dr Bob (by whom I bought the XE2 license - since the 1 $ = 1 € equation sounded a bit unfair, I wanted at least to have a real Delphi expert for being my reseller).

Here is his answer:

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).

So I'm afraid this is some regression...

Edit at closing question:

First point is that adding full paths:

  SynPdf in '..SynPdf.pas',

in the .dpr did let the files been found - but the background compiler is still lost, unable to find a class declaration in this body.

Just another regression sample:

   var Thread: array[0..3] of integer; 
       Handle: array[0..high(Thread)] of integer;

Is a perfectly safe syntax, compiles just fine, was interpreted by the previous Error Insight compiler without any problems (works since Delphi 5), but fails under XE2.

I'm a bit disappointed about XE2 IDE. Compiler makes it work. But IDE is really disappointing. It is not usable, from my point of view. I'll continue using Delphi 7 as my main editor, and just use XE2 as cross-platform compiler and debugger.

这篇关于Delphi XE2后台IDE编译器找不到源路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆