简体   繁体   中英

.pas file not found but the .dcu is there, is that not enough?

In Delphi 7 I have in the 'Tools/Environment options/Library' under my 'Libray path' the following directory :

C:\ggProgramFiles\QR-synopse-pdf-files

In there I have some Pas files and their Dcu files. One of the files here is QRPDFSynFilt.pas and QRPDFSynFilt.dcu

Now my problem is that since the pas files are available there I always step into them while debugging and I find that annoying.
So I made a new directory :

C:\ggProgramFiles\QR-synopse-pdf-files\dcu  

and copied only the dcu files there.
Then I altered the path in 'Tools/Environment options/Library' to point to this new directory.
But now Delphi 7 tells me he cant find

C:\ggProgramFiles\QR-synopse-pdf-files\dcu\QRPDFSynFilt.pas

and that is correct only the dcu is there.
But I always believed that when Delphi finds the DCU file that would be enough, the PAS file would not be needed if the DCU is found.

So my question is does Delphi needs the PAS file to compile or is the DCU enough and if the latter is true what could cause Delphi to give me this error ?

EDIT on Deltics answer

I could use the compiler directive {$debuginfo OFF} but since these units are 3th party I did not wanted to edit them. If nothing else works I will still do that.

EDIT on Davids comment : the compiler error is

[Fatal Error] File not found 'C:\ggProgramFiles\QR-synopse-pdf-files\dcu\QRPDFSynFilt.pas'

Yes,if you have the dcu then this should be enough. Something else is wrong in your setup. However, instead of trying to fix that and introducing and trying to deal with complexity into your build environment I would instead " fix the first problem ".

Instead of trying to fool the compiler, just add a {$debuginfo OFF} to the top of any pas files you never want to debug:

{$debuginfo OFF}

Then regardless of compiler settings in the project, these units will never be compiled with debug info and the debugger won't step into them. To re-enable debugging you can simply add a . to the directive after the { to turn it into a comment:

{.$debuginfo OFF}    // This is now just a comment, not an active directive

Syntax highlighting will make the difference clear (assuming you have comments and directives configured with different colors etc, which imho is a good idea anyway).

It might make sense to put this directive inside a conditional compilation directive which so that you can enable or disable debugging of these specific but related units with a project conditional:

{$ifdef debugQRPDF}
  {$debuginfo ON}
{$else}
  {$debuginfo OFF}
{$endif}

Any units with this at the top will have debug enabled or disabled not by the project compiler setting but by the project conditionals. You then don't have to worry about trying to "hide" pas files from the compiler just to avoid debugging them.

Don't forget that when changing project settings, such as conditional directives, a FULL rebuild is required for those changes to be properly reflected in the build.

You probably have the file in the project list. This effectively tells the compiler you want to compile it. You will need to remove it from your project, but leave the references in the uses clause of each unit that references it.

If it is a third party Component Library and the vendor has supplied the source you can open the Design time package and recompile it with the Debug Info turned off. This will create new dcus which the debugger will not try to debug into the associated .pas file. You will find this setting under the Project Options. Go to Delphi Compiler -> Compiling -> Debugging -> Debug Information. Change the setting to OFF.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM