[DCC Fatal Error] Unit1.pas(7): F1026 File not found: 'MyBitBtn.dcu'
Unit1 is a VCL Form for test purposes.
I have installed a design time package which contains a custom component that derived from TBitBtn. I can load the MyBitBtn in the Delphi IDE, load up the custom images I coded in design time and it seems like it works fine, at least visually. I get the above compile time error when I try to compile the test project.
I have a package group that has one design time package and one run time package. Design time package registers the component and Runtime package inherits the TBitBtn and has the custom code in it. The design time package contains the RunTime DCP file in the requires section.
The moment I insert the custom button on the test form, IDE creates the USES clause for MyBitBtn file. And that file apparently can't be found. Shouldn't that be part of the package installed?
Most probable you did not set 'Unit output directory' option in your runtime package, so package .dcu's are not available; I usually set it to $(BDSCOMMONDIR)\Dcp and have no problems.
Generally, the .dcu's of a runtime package should be available via global IDE library path if you want your package to be available to any project:
.
You should either use one of the existing paths or add your own.
The design part works, but for run time, the compiler must be able to find the dcu.
You can do that either...
By adding the dcu folder to the library path of the IDE.
By adding the dcu folder to the search path of the project.
Or by adding the dcu explicitly to the project.
I would choose the first option. Since it's an installed component, you would want it to be available for any project, so setting the library path makes the most sense.
define the path where this dcu is stored in system environment. And dont forget to include it in Delphi env paths.
Go to ZEOS files, open packages, choose your version(DelphiXE10/Delphi7 ...) then go to the Win 32 file, open it and open Debug folder. Copy every thing, go to Program Files, Embarcadero, Studio, 17.0, lib, Win 32, Debug and paste, do the same in every win32 folder... Hope it helps :)
Related
Today I'm trying to figure out why something works when I think it should be broken.
I have little Delphi experience, and I've inherited a Delphi codebase and am setting up a machine where it will be maintained and compiled. I have a package that compiles successfully but can't figure out how it is resolving one of the types. My understanding is that when you use a unit, you must either
Include the source file in your package directly
Resolve the source pas or dcu file on your project search path
Resolve the source pas or dcu file on your IDE library path
None of these appear to be happening, and yet the package compiles. How else could this be compiling successfully?
Details
I have 'base' package that has a direct include on the file THotLog.pas. The file appears under the project's Contains folder in Project Manager. THotLog is NOT one of the components in the package, it is not in the register procedure for base package.
I then have 'consuming' package that requires base package. Consuming package has several components with THotLog members, and consuming package compiles. This surprises me, because I thought consuming package would have to be able to locate THotLog.pas or THotLog.dcu.
This is for RAD Studio 10.1. The project search path (Project > Options : Search path) is empty, and the IDE search paths (Tools > Options , then Environment Options > Delphi Options > Library) do not include where THotLog is.
I've also tried renamed all THotLog files on the hard drive and consuming package still compiles.
Hypothesizing that my understanding about type resolution is wrong, I tried making a set of sample projects with a similar layout and the sample consuming package cannot resolve sample THotLog without locating the pas or dcu file.
When you build a Delphi package, the compiler/linker creates a Compiled Package File named [package-name].dcp. It is a binary file containing all of the compiled units included in that package.
Compiling your "base" package created a [base-package].dcp file that is visible to the "consuming" package. The "consuming" package is referencing the base-package in its "Requires" section; this is the link to the base package's DCP file.
Delphi Compiled Package File
When I tried to compile one of my BPL files, I get an error:
dxGDIPlusClasses.pas not found.
I double checked the unit file exists on the hard drive.
I also added $(BDSCOMMONDIR)\Dcp to the DCP Output directory, and $(BDSCOMMONDIR)\Bpl to the Package Output directory. The runtime package containing the unit was also added to the BPL.
I searched online for answers, foound one suggestion to enable Build with runtime packages under the Project Options, but when I checked I dont have that option.
Does anyone know how to solve this?
The error message indicates that either:
the compiler can't find the source file it needs for the unit.
the compiler found a .dcu file compiled with a different version of the compiler and needs to recompile it.
.dcu files are not compatible across compiler versions (with the single exception of D2006->D2007), meaning that every new version release of the compiler means all your source needs to be recompiled in order to be compatible with it.
You need to add the path to the source to Project->Options->Directories and Conditionals->Search Path so it can find the source code it needs.
I want to make changes to the xmldom and XMLDoc files. I tried to, but I don't know how to test those changes because the program does not seem to be running the code in those files. I tried using a ShowMessage to see if that code was being accessed but it never showed up. Even if I rename the directory the files are in, the program still compiles fine as if it is not actively reading the files at run time but instead has the information stored elsewhere.
How can I change these namespaces and then make sure that the changes are being included in my next compile?
Update
Well i'm looking for an answer in general.. Because I have had this problem in multiple situations.. But for specifics Changing XML node attribute value gives "Namespace error" (here the answer talks about changing the 'AdomCore_4_3') I want to be able to change it and have the change show up when I compile.
If you've removed the compiled DCU files from your environment, and your changes still aren't being compiled into your project, then you either aren't really using those units at all, or you have run-time packages enabled.
With run-time packages, the compiled code is accessed from the BPL file, not the DCUs. You're not allowed to distribute modified BPL files, so if you're going to modify the Delphi-provided source code, you need to make sure you're not linking the package with the XML units to your project. You can control that in your project's linker options.
As long as you are not making changes in the interface section of the units, only the implementation section, then you can disable use of Runtime Packages in your Project Options and then add the modified source files directly to your project. The compiler will compile them into new .DCU files and use them instead of the default .DCU files.
I am trying to recompile/rebuild an old application program developed on Delphi5. I used the same Delphi5 software on an XP computer.
I did some minor corrections to the codes of a couple of forms and units. When I recompile using the .dpr file it comes with a fatal message: File not found System.pas
I added in .dpr file on the link path to this file BP folder. No success and the same message. Any clue will help.
Probably Library Path is broken after running some buggy component installer. In modern IDE's look for Tools -> Options -> Library -> Library Path from main menu (should be slightly different for Delphi 5).
System.dcu file lives in $(BDS)\Lib path for Delphi 2007.
The "File not found System.pas" error often isn't really because it can't find system.pas. It's some other problem that manifests as this error.
It can be:
Duplicate Path entries in the Library Path.
Too many entries in the Library Path - I think the limit is 99.
Path to a package in Library Paths too long.
Path to a package in Library Paths corrupt.
Environmental Variables not set correctly.
and possibly more if you Google "system.pas not found"
Marjan is right.
But also add ${DELPHI}\LIB\OBJ
If you still have a dcc32.cfg with the project, or a .cfg with the project, open it up to see if the settings in there are correct. Otherwise delete the .cfg or edit it to reflect the proper path to the bin and bin\obj directories.
A .dpr file is the main project file for a Delphi 2,3,4,5,6,7 project.
You have not given any details like WHAT WAY OF BUILDING SOMETHING of delphi you're using (the code is Delphi 5 level code, but you are not telling me for example, if you built the project inside the Delphi IDE or from the command line compiler DCC32), and what other files you have installed. You haven't mentioned if the library paths and so on are configured (either for the IDE, or for the command line environment, both of which are separate tasks).
An inability to find System.pas suggests to me that you might be running the command line compiler (Dcc32) instead of the IDE to build the project, and you have forgotten to mention that. That usually means you have to set up the Options (dcc32.dof) file for Delphi, so that command line building with Dcc32 can work.
What exactly do you mean by "When I compile with the .dpr file"? Instead of making people guess, show the commands you typed, exactly, and the error message, exactly. If it helps, use screenshots or text grabs.
I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Requires list. "Required package 'A' not found."
How do I tell B and C where to find A so they'll build correctly?
Either the package can't be found, or the compiler is confused. In the later case, a restart sometimes helps. Then a manual build from all packages in order.
If it really can't be found, check if all package (bpl and dcp) and dcu files are available. You need both.
If this happens when the IDE is trying to load a package: your package output directory (where the *.bpl files go) has to be on your system's PATH environment variable. Packages are statically linked DLLs, Windows has to be able to find them to load them.
If this happens when building the packages: any/all of your DCP output directories (where the *.dcp files go) have to be in the dependent projects' search path so that the compiler can find the compiled packages.
You can also leave the DCP output directory of the package project empty - in which case the global DCP output directory set in Tools\Options\Library is used; the dependent projects then don't need to include it in their search path.
It is possible that the name of the required package is incorrectly specified in the 'requires' clause of the package you are trying to compile. Let's take an example:
We have two packages - VirtualTreesR.dpk and VirtualTreesD.dpk. VirtualTreesD requires VirtualTreesR. They both have the '16' suffix, so they both are displayed in the Delphi project manager window as VirtualTreesR16.bpl and VirtualTreesD16.bpl. You may think that these are the names of the packages, but you are wrong. The names of the packages are still VirtualTreesR and VirtualTreesD, not VirtualTreesR16 and VirtualTreesD16.
When VirtualTreesR.dpk is compiled Delphi produces two files (I don't talk about DCUs here) VirtualTreesR*16*.bpl and VirtualTreesR.dcp. See the difference?
Then we attempt to compile VirtualTreesD.dpk and get the error: "[DCC Fatal Error] VirtualTreesD.dpk(35): E2202 Required package 'VirtualTreesR16' not found".
The error happens because the 'requires' clause of the VirtualTreesD.dpk package contains the following lines:
requires
designide,
VirtualTreesR16;
Delphi tries to find VirtualTreesR16.dcp and fails even if the Delphi search path and the PATH environment variable are set correctly because there is no VirtualTreesR16.dcp. Only VirtualTreesR.dcp.
The solution is to fix the 'requires' clause so it will look like the one below:
requires
designide,
VirtualTreesR;
Hope it helps.
P.S. This a quite frustrating issue because this name mismatch is not obvious and its fragments are scattered across different settings. Delphi could be more specific if it specified what file exactly it tried to find (e.g. 'VirtualTreesR.dcp' instead of 'VirtualTreesR').
I would check to make sure where you are writing the .dcp files for the packages. once you have this, check that the search path of each package has an entry for the .dcp output folder.
I sometimes receive the "package not found" error when adding required packages via the Delphi Project Manager context menu. (Open a package, right click "Requires", choose "Add Reference..." command)
Instead it's easier to add the required package by editing the package project file manually:
Select the package in the Project Manager. MyPackage.bpl for example.
Ctrl+V to open the project file.
Add the required package to the requires clause.
Ensure the required package *.DCP file is in the package search path.