Is there a project/compiler/linker-setting that can force brcc32.exe to run on some or all .rc files included into the project? By default only .rc files that have changed get re-compiled, but not when any files included by the .rc are. For now we manually delete the .res file(s) to force a re-compile.
Update: inspired by the accepted answer, I wrote this: https://gist.github.com/2868141
Haven't used Delphi for years, but as far as I remember you can define pre-build events, can't you? You could touch all the rc files before building.
Related
I thought Delphi would automatically compile resource files when I add them to my program, like
{$R 'resource.rc'}
but the linker returns an error message Error reading file "D:\resource.rc". When I look into project options, however, brcc32.exe is explicitly listed as resource compiler to use:
I know I can invoke the resource compiler from the CLI, but I'd prefer to have resources compiled automatically. How can I do this? I'm using Delphi XE8.
You need to add the resources to the project using the Resources and Images item on the Project menu.
#Joris Grootman I know I'm VERY late to the party, but as another alternative you could set up a "pre-build" event in Delphi (Project Options | Build events | Pre-build events | Commands) to run the resource compiler command before the project builds, and since it's just a quick process you should not notice it slowing down the Delphi build.
Its better and more flexible to list all of your resources in an RC file and then add this file to your project (Project > Add to Project), The IDE will add the $R directive to the project's DPR file, and the RC file will now appear in your project files pane where you can double click it to open it in the editor so you can add/edit/delete resource as you wish.
This way, Your RC file will be compiled automatically and linked to your executable whenever you compile your project.
I recently got project in delphi which I need to rearange, I'm totally new in delphi so I'm searching my way in environment and language. Question, in my project group I have two files with .dproj extension, no corresponding .dpr file so when I try to load them I got msg:
"Canot open file xxxx.dpk, system cannot find the file specified"
Did the old programmer forgot to copy all files so I'm missing this, or is this some kind of file (.dproj) that I only add as a reference so I don't need to have corresponding .dpk or .dpr file??
The .dpk file is the top level Pascal source file for a package. It is the package equivalent of an application project's .dpr file.
The original developer should have supplied it to you. Ask them to do so.
I happened to notice a <DCCReference> tag that referenced a file that didn't even exist. What is the point of these tags? What would be the consequences of deleting them?
Thats the XML it uses to store what the project is. If you add anything to the dpr file it changes the dproj to suit. If you add a file to the project from the ide it changes both the dpr and the dproj. You can delete the entry, its self repairing to some extent. Also, a file does not need to be in here to be included in the compile. If a unit has it in it's uses clause then it will be pulled in.
If it keeps coming back then remove the unit from the project in the ide. If its not there then remove it from the dpr.
Finally 2007 has a bug where it can add multiple variations of a file name into the dproj. You have to delete the offending ones manually.
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.