Delphi调试错误的单位 [英] Delphi debug a wrong unit

查看:115
本文介绍了Delphi调试错误的单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是D2006的奇怪行为,因为它有时只发生。我有一个我想调试的项目。我要调试的文件名为Main.pas。我有另一个不相关的项目具有相同的单位名称,有时调试会提示我错误的主文件,而不是当前项目的主单元。这发生在与其他具有相同名称的文件中。我无法调试,因为调试键不起作用(他们只是不做任何事情)。你遇到过同样的问题吗?如何解决?



谢谢。

解决方案

使用相对路径?



如果是,我发现它有助于将工作目录设置为我的项目目录,并使用File-> Open从我的项目目录加载文件。导航和加载可见设置工作目录,修复您认为您正在使用相对于您的项目的路径的情况,但是delphi相对于IDE的工作目录来解释它们。
首先关闭所有其他选项卡,以避免错误。由于delphi编译器是一个dll,它会与IDE进行深入的交互,并且可能会访问哪些文件被打开。 (它可以编译未保存的文件!)



如果没有,这可能是一个怪异的事情,但仍然有相同的起源。开发习惯先关闭其他文件(右键单击tab->关闭所有其他文件),并修复工作目录(通过文件加载单元 - 打开解决方法)可能会有所帮助。


$ b $我感觉到BDS系列的IDE似乎比这些经典的IDE更为困难,但是经典的问题也存在。可以像在BDS中使用更多花哨的opendialog选项一样简单,增加了工作直径更改的机会。



更新其他项目是开放的帮助。因此,在打开新项目之前,请始终单击旧项目,如果IDE在另一个项目加载时打开,请不要单击Windows资源管理器中的项目。



Delphi XE仍然遭受这种


This is an odd behaviour by my D2006 as it happens sometimes only. I have a project I want to debug. The file I want to debug is named 'Main.pas'. I have another unrelated project with the same Unit name and sometimes the Debug prompt me the wrong Main file instead of the Main unit from the current project. This have happened to me with other files with the same name. I can't debug then as the debug keys don't work (they just don't do anything). Do you have experienced the same problem? How can I fix it?

Thanks.

解决方案

Do you use relative paths?

If yes, I found out it helps to set the working directory to my projects directory y loading a file from my projects dir using File->Open. The navigating and loading apparantly sets the working dir, fixing the case where you THINK you are using paths relative to your project, but delphi interprets them relative to the working dir of the IDE. Close all other tabs first though, to avoid mistakes. Since the delphi compiler is a dll, it interacts deeply with the IDE, and probably has access to which files are opened. (it can compile unsaved files!)

If not, it might a freak occurance, but still have the same origin. Developing a habit to first close other files (right click on tab->close all other), and fixate the working dir (with the load unit via file-Open workaround) might help.

I've the feeling the BDS series of IDEs seem to suffer from this more than the classic ones, but the problem existed in the classic ones too. Could be as simple as using more fancy opendialog options in BDS, increasing the chance on working dir change.

update Also only opening projects when no other projects are open helps. So always click the old project before opening the new, and don't click a project in the windows explorer if the IDE is open with another project loaded.

Delphi XE still suffers from this

这篇关于Delphi调试错误的单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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