Upgraded Custom Component won't compile - delphi

We're currently looking at upgrading some of our Delphi applications from XE7 to 10.3 and have run into a problem with our custom components.
I've tried 2 options.
I've copied, opened in 10.3, and re-compiled the original component package.
I've created a new package in 10.3, added a copy of the relevant .pas files, and compiled a new .bpl/.dpk file.
In both cases, I get a package that I can install into the IDE, and which allows me to add the component into a new project.
However, in both cases, I get "Can't resolve unit name "NewComponent"" in the IDE, and "Unit "NewComponent" not found" when I try and use the component in the project.
I remember this being an issue on previous Delphi updgrades, but have forgotten the trick to fix it.

For my own packages, I have a separate Lib folder \[delphi]\Lib2, then I set the BPL Output Directory in the IDE to that folder, add it to the IDE's Search Path and the OS Path.
That's all I find is necessary and it works fine.

Related

Can't Compile Compil32.dproj using Delphi 10.1

Hello I want to recompile Inno Setup Compiler's source code to rename the Uninstall Executable Generation like unins***.exe.
When I try to compile, Delphi says that Error Reading Form : Class not found because my Delphi IDE haven't all the packages needed to compile Compil32.exe.
If I compile my Compil32.exe without all missing classes and run it, Compil32.exe has stopped working appears as it isn't correctly compiled.
Please tell me what version of Delphi or what IDE Packages want to be downloaded and can be used to compile / build Compil32.exe without any problem.
Thanks in Advance.
It's a bit confusing.
Readme does say you need to install components
The readme.md address this issue.
Let me quote it for you
Component Installation
If you intend to view or modify the Setup project's forms, you must install the following component units, which can be found in the Components directory.
BidiCtrls
BitmapImage
FolderTreeView
NewCheckListBox
NewNotebookReg
NewProgressBar
NewStaticText
PasswordEdit
RichEditViewer
If you intend to view or modify the Compil32 project's forms, you must additionally install the following components. (Like the Compil32 project itself, these require Delphi 3 or later.)
DropListBox
NewTabSet
But the readme does not tell you how to do this
The readme assumes you know how to install components from scratch.
This is a bit of an assumption and I can see why you're getting stuck here.
In Delphi you need a create a .dpk (package) file to put your components in.
Choose File->New->Package
And add all of the units listed above to your package.
Now build the package and then install it.
You should be seeing a message that 11 new components have been installed.
If this is successful you can open the forms.
If you have previously ignored any errors and saved the project Delphi will have removed the components. In that case you'll need to reload the project from github.

Unable to install bpl after building it in project upgraded from C++ Builder 2010 to C++ Builder 10 Seattle

I have a large project group I'm in the process of updating from C++ Builder 2010 to Seattle. So quite a jump :) I have run into several issues and managed to solve them all but yesterday I scratched my head a bit. One project builds a bpl used by other parts of the system. After some minor code tweaks it compiles fine but when I right-click the project to "install" the bpl I get an error message saying
The procedure entry point
#TLanguageDialog#$bctr$qqrp25System#Classes#TComponent could not be
located in the dynamic link library TranslationTools.bpl
TComponent is part of the VCL library if I remember correctly so I'm trying to figure out what the issue here is and how to solve it. Has something in the way bpl's are constructed changed so it's expecting something that didn't use to be there or what? As said it compiles just fine, but just in case here are the settings for the include and lib paths.
Include: $(BDSINCLUDE)\windows\vcl;$(BDSINCLUDE)\windows\vcl\design
Lib: $(BDSLIB)\$(PLATFORM)\$(Config);$(BDSLIB)\$(PLATFORM)\Release\psdk
The solution ended up being rouge bpl files like Remy sugested. bpl files had ended up in System32. Although all installed bpl files had been uninstalled in the IDE a version of the build project was once installed to the system and wrote bpl files to System32 which caused the IDE to try and use these and not my newly compiled ones.

What Is a .vrc file, how is is generated and can you remove it using the IDE?

I am trying to install a commercial component called JamShellBrowser but it will not install.
I have contacted the developer, but meanwhile I'd like to know:
What is a vrc file?
How is it produced?
Can it be controlled or modified with the Delphi XE4 IDE?
I checked the IDE's help but I could not find anything about vrc files and I searched for Delphi vrc and did not find anything that would help me.
The error message is:
Checking project dependencies...
Compiling JamShellDelphiXE4.dproj (Release, Win32)
brcc32 command line for "JamShellDelphiXE4.vrc"
c:\program files (x86)\embarcadero\rad studio\11.0\bin\cgrc.exe -c65001 JamShellDelphiXE4.vrc -foJamShellDelphiXE4.res
[BRCC32 Error] JamShellDelphiXE4.vrc(2): file not found: JamShellDelphiXE2_Icon.ico
Failed
Elapsed time: 00:00:00.1
I searched the components folders for an ico file, but there is none... thus the message, but even if I remove the line MAINICON ICON "JamShellDelphiXE2_Icon.ico" from the vrc file or even delete the vrc file it is automatically generated when I try to install.
I moved from Delphi 2010 to XE4 a few months ago and noticed the apparently new vrc file but I do not know what it is or how to handle these files.
A .vrc is a temporary file created by Delphi MSBuild process to compile resources files (.res) which will be linked in the final binary output. It is passed to CodeGear Resource Compiler/Binder (cgrc.exe) and deleted after the build process.
It doesn't appear anywhere in .dproj file. This behaviour is from BuildVersionResource target, imported from $(BDS)\Bin\CodeGear.Common.Targets. Look at this file (and at CodeGear.Delphi.Targets) if you want to get a better understanding of build process.
Removing <Icon_MainIcon> tag from .dproj it's not enough, as VERSIONINFO resources can also force the creation of .vrc file (I believe "vrc" stands for "Version Resource", although it is also used for main icon in applications).
In case of packages, Delphi always put version info in packages projects. The "include version information" IDE option is ignored with package projects.
So, if you (like me)
don't rely on Delphi IDE to set application main icon
don't rely on Delphi IDE to set version info resources; and
do manage to include your own resources files for everything
you can disable its creation entirely by setting the SkipResGeneration to true in your msbuild call. E.g.:
msbuild.exe myProject /t:Build /p:Config=Release /p:SkipResGeneration=true
However, this only works for MSBuild-based builds. I don't know how to do the same for builds from Delphi IDE.
Just open your #PROJECT#.dproj in any text editor file and find lines
<Icon_MainIcon>#PROJECT#_Icon.ico</Icon_MainIcon>
and delete them.
You will find one per Build target.
Save the file and you are done.
Edit: The original answer referred to the .dpr file, however note the section to edit is in the .dproj hence I've updated the the answer above to reflect this.
I believe this is a built in IDE behaviour of Delphi XE4 and XE5, possibly caused by an upgrade bug. Generation of VRC files is something that you can not disable except by removing the tags in the dproj file that cause it to be generated.
If there was a way to fix it or remove it, it might involve comparing your dproj file with another dproj file and looking for something that was appropriate only to a .dpr+.dproj Project that somehow got into your .dpk+.dproj project, like <Icon_MainIcon>.
It appears to be an intermediate file that is auto-generated when a .dpr+.dproj project has some version information which must be written out of the .dproj file, and into a temporary location and then compiled and linked into your application as a version info resource. However, I have also seen it get generated for a .dpk+.dproj project, and this mystifies me as well.
It also seems to contain a resource for your default application icon and version information, and packages do not normally have a versioninfo or application icon resource.
What I find to be possibly a BUG is that there is no UI in the Delphi IDE to let you set the Application Icon of a Package. Yet, I sometimes get a .VRC and an .ICO file. But I am not aware of a fix, other than to report the issue to Embarcadero Quality Central.
With a .dproj project, a .VRC intermediate file makes at least some sense. I see the following content: Version Info, Application Icon, and VCL Styles (ie AquaLightSlate.vsf) resource linkage.
this is a clarification...
I've just started to install several component libraries into Delphi RAD Studio XE5 that I've got installed in XE2 and XE4. When I try to Build most of them, I get this same error.
The problem isn't so much the .vrc file itself, it's this particular error:
[BRCC32 Error] <project_name>.vrc(2): file not found: <project_name>_Icon.ico
I can't figure out a way to bypass it, and I have no idea what it's looking for or where.
I tend to copy my component libs from one version to the next, opening them, building them, and installing them (ie. the ones that don't come with installers). I've never seen this happen in prior versions. However, this is the first time I've had RAD Studio installed; in the past I've just had Delphi. So perhaps it has something to do with having C++ installed as well?
I had to change my X.optset file to get this to work.
X being the name of your Delphi version you brought over these options from. Mine was PolyDelphiXE2.optset.
Once I corrected the name here no more funny compiling that brought in a different ico reference.

How do I modify Indy 8 IdMessage.pas with Delphi 6?

I have a copy of Delphi 6 and a simple email program that uses the Indy TIdMessage component. I want to remove lines 464-465 of IdMessage.pas then recompile the application. I'm having a hard time finding clear documentation, so I tried these steps to modify the component:
opened \delphi6\source\indy\indy.dpk in the IDE
double-clicked IdMessage.pas in the Package window
edited IdMessage.pas and saved the file
clicked "Compile" in the Package window
clicked "Build Indy" in the Project menu
clicked "Install" in the Package window
But then I get an error that \bpl\indy60.bpl can't be loaded because \bin\indy60.bpl is already loaded. So I tried "Install packages..." in the Components menu, but only found \bpl\dclindy60.bpl there. So I removed that package, and:
opened \delphi6\source\indy\dclindy.dpk in the IDE
clicked "Compile" in the Package window
clicked "Build dclIndy" in the Project menu
clicked "Install" in the Package window
The IDE confirmed all the components (including TIdMessage) were installed, but the email program is still acting as though the original unmodified component is still being used.
What am I doing wrong?
if you were using runtime packages then you'd need to ensure that your program found the new package file, the .bpl.
But you probably are not using runtime packages. So the runtime program statically links the Indy code using .dcu files located in the Delphi installation folders. Specifically in this case to <ProgramFiles>\Borland\Delphi6\Lib\IdMessage.dcu. You need to make sure you link the new code. The easiest way is to add the modified file to your project. That will mean that the modified version gets compiled and linked into your program.
Since your modifications are in the implementation section of the unit this is all you need to do. If the modifications were in the interface section you'll encounter "Unit X was compiled with a different version of Unit Y" errors. You'd solve that by adding the rest of the Indy source to your project.
One point to stress is that you should never modify the files under the Delphi installation folder. If you want to build modifications to those components, take copies of the files and make modifications in those copies.

Why Delphi says "Unit xxx compiled with a different version of yyy" if all my paths are correct?

First of all I would like to apologize for the question itself. I simply could not make anything better. Well, the question then follows with examples and detailed ...
I manually installed QuickReport Delphi 2006 from their sources. It is composed of two packages a "DesignTime" and a "RunTime".
My Delphi is configured to build the BPL files in "D:\BPL" and DCP files on "D:\DCP" for all packages compiled on my Delphi
The source code of QuickReport are in "D:\QuickReport" and their packages (design and runtime) are configured to save the compiled units (DCU) in the folder "D:\QuickReport\DCU." This was the only configuration done in the packages. Nothing is set up with different paths and, BPL and DCP files are placed correctly in the folders I've set up, as I mentioned earlier.
With these settings I was able to build and install QuickReport without problems (just a few compiler warnings, which I believe are normal). All QuickReport components appear in your palette in Delphi, which does not emit any error on start proving that the components are properly installed and all packages were found.
Now comes the test: I started a new win32 application, completely empty, just a blank form. Then it put a QuickReport component (TQuickRep). The first thing I noticed was that the unit "QuickRpt", which is automatically placed in the clause "uses" of the "interface" is underlined in red indicating that something is wrong.
When I perform a CTRL+ENTER in "QuickRpt" unit (uses clause), the Delphi finds the source file (.pas) correctly, which is in "D:\QuickReport" then I ran a BUILD ALL command and the following compilation error appeared:
[Pascal Fatal Error] Unit1.pas (7): F2051 Unit QuickRpt was compiled with a different version of QRExpr.TQREvElement
That's it!!!
This error is only happening with Quick Report. I have other third-party components installed using the same configuration as the paths and they all work properly.
Finally I was able to solve this problem. #RRUZ and another friend gave me the tip: An lost QuickRpt.dcu file on my system. There were a QuickRpt.res file also. I found them, but the place was very improbable to me: The delphi LIB folder!!!
Well, i have some clues about this bizarre thing.
Until Delphi 7, the QuickReport was shipped together with the IDE however, it was disabled by default. On that Delphi version, all we need to do is to register the bpl to gain full access to QuickReport!
On Delphi 2006, the QuickReport is not part of IDE and there are no BPL to register, however the guys at Borland forgotten to remove all files from the old QuickReport. The Delphi Lib Folder is one of the first folders to be checked on Delphi start, so, if there are old files there, new files on another place would be never compiled, generating the annoying error!
This problem may be present on Delphi 2005 too.

Resources