Delphi 2010 中的代码导航在 $IFDEF 块内部中断

发布于 2024-12-27 10:36:57 字数 381 浏览 2 评论 0原文

我的应用程序中有一些条件编译的类。

{$IFDEF SOME_OPTION}
type
  TMyClass = class
    procedure Foo;
  end;
{$ENDIF}

...

{$IFDEF SOME_OPTION}
procedure TMyClass.Foo;
begin

end;
{$ENDIF}

该选项 SOME_OPTION 是在该项目的“项目选项”-“Delphi 编译器”-“条件定义”和“项目选项”-“资源编译器”-“目录和条件”-“定义预处理器符号”中定义的。

当我尝试按住 Ctrl 键并单击他们的方法时,没有任何反应,代码导航不起作用。

我使用Delphi 2010。我该如何解决这个问题?

I have a few conditionally compiled classes in my app.

{$IFDEF SOME_OPTION}
type
  TMyClass = class
    procedure Foo;
  end;
{$ENDIF}

...

{$IFDEF SOME_OPTION}
procedure TMyClass.Foo;
begin

end;
{$ENDIF}

That option SOME_OPTION is defined in "Project Options" - "Delphi Compiler" - "Conditional Defines" and in "Project Options" - "Resource Compiler" - "Directories and Conditionals" - "Defines a preprocessor symbol" for this project.

When I try to Ctrl+Click on their methods, nothing happens, code navigation don't want to work.

I use Delphi 2010. How can I solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风向决定发型 2025-01-03 10:36:57

这是一个错误,修复的可能性为零。

/ 沃伦·P

It is a bug, and the chances of it being fixed are zero.

/ Warren P

只想待在家 2025-01-03 10:36:57

我认为正确的位置不是在“项目选项”-“资源编译器”中...
但是在“项目选项”-“Delphi编译器”-“条件定义”中。

更新:
我在 Delphi XE 中尝试过,无论它是否定义,或者在哪里,对于 Ctrl+Click 在所有情况下为我工作似乎并不重要。
请注意,我有 已安装 Andreas Hausladen 的 IDE Fix Pack 4.6.6 和 DDEv Extension 2.5。
你用它们吗?

更新2:
当在同一单元中时,即使 SOME_OPTION 未定义,它似乎也能工作,当从另一个单元调用 Foo 时则不起作用。
但似乎有效的是,当它在项目选项中正确定义时并且您重建应用程序(您会在调用 Foo 的行上看到蓝点)。然后IDE可以使用编译器来定位另一个单元中的函数源。

目前我能想到的就这么多。正如已经说过的,它不是 IDE 最好的部分......

I don't think the proper place is in "Project Options" - "Resource Compiler"...
But in "Project Options" - "Delphi Compiler" - "Conditional Defines".

Update:
I tried in Delphi XE here at work and whether it is defined or not, or where, does not seem to matter for Ctrl+Click to work for me in all cases.
Note that I have Andreas Hausladen's IDE Fix Pack 4.6.6 and DDEv Extension 2.5 installed.
Do you use them?

Update 2:
When in the same unit, it seems to work, even when SOME_OPTION is undefined, but not when Foo is called from another unit.
What seem to work though is when it is properly defined in the Project Options and you rebuild the application (you see the blue dot on the line calling Foo). Then the IDE can use the compiler to locate the function source in the other unit.

That's all I can think of for the moment to help with that. And as has been stated already, it's not the best part of the IDE...

天涯沦落人 2025-01-03 10:36:57

Is not working because you have not well defined your compilation directives. Directives must be defined as described here http://docwiki.embarcadero.com/RADStudio/en/Delphi_compiler_directives in the Using the IDE section. A good practice is also to recompile the project after conditional directives are changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文