C++ Builder File Version not correct - preprocessor

I have set the file version in Project->Options->Version Info (yes the "Include version information" is ticked).
I have for example FileVersion: 0.95.1.73 set in all release configurations.
But when I rebuild, the File version is always set to 0.7.8.28
It doesn't matter what I set the FileVersion to, I always get 0.7.8.28.
The Copyright text is also from a very old version.
I tried to clean delete all files obj, res, tds etc in the Win32/Release folder of the project. But same result every time.
The project file (XML) do have the new FileVersion of 0.95.1.73.
This problem only happen on Release config, Debug config is working fine.
Any clue of where to look? Any compiler/preprocessor directives that can override this?

No, there is no compiler/precompiler directive to override this. You have a conflicting version resource defined somewhere. If it is not in the .cproj file (which can have multiple build configurations defined, each with their own version info), then there has to be an offending .rc/.res file somewhere on your project's search path that is being linked into the final executable. Version info does not come from anywhere else, it is either defined in the project itself, or it is linked from a resource script/file.

Related

Delphi 11 Alexandria: Version info is missing from EXE

(Original question: I added a VERSIONINFO resource to the project, but it is missing from the compiled executable. I did a text search both in ANSI and Unicode, but the pattern is not found. Of course, the "Include version information in project" checkbox is ticked. Is it a bug or something I missed?)
Edited:
I try to reproduce the problem step by step with an empty project, but I can't, because the compiled program will contain the required version info. The steps are:
– I created an empty VCL forms application project
I repeated 2 steps below for all combinations of platforms and configurations:
-- in Project options/Version info I added a key "foobar" with value "barfoo"
-- I set Locale ID to $040$
saved and compiled the project
checked with Resource Hacker, the version info contains VALUE "FooBar", "BarFoo"
But then in the original problematic project, I see very similar version info settings: all platform/target combinations contain the specific key/value pair, locale ID's are set to $040$. So there are some magically wrong settings, perhaps in the .DPROJ file, that cause that the compiled exe won't contain the added key/value pair in the version info.
Edit2:
Sorry, the correct Locale ID is $040E (Hungarian). Both projects use the same toolchain. GExperts and a hacked version of DDevExtensions is installed. I tried to use ProjectMagician but later uninstalled. But those do not affect the problem. I use UPX, but the examined exe is unpacked. Later I re-imported the problematic project into XE11 as if it was a D7 project: I deleted all the project files except the .DPR, reopened the project and added target platform Win64, version info values and all other project settings manually. After a succesful compile, the problem still persists. I think, the project has a hidden or erroneus reference to an invalid resource file. But I still can't find it.

nocache.js not found in Vaadin project

"Requested resource [/VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js] not found.." I get this when I'm including new addons, either from a JAR file or through Maven. Sometimes, if I've added the dependency in Maven, adding the JAR file as well to the build path fixes it, sometimes it's the other way around, other times compiling the widgetset and/or theme fixes it, and there are even times when nothing helps. This type of behavior seems to me more random than scientific.
I would love to know how to properly add dependencies to the project so that I can avoid this problem.
Select the UI project and goto Properties - Deployment Assembly. Check if you already have widgetset.jar file. If the widgetset.jar is missing then Click on Add -> Maven Project and select widgetset (make sure the jar file naming convention follows backend project like WEB-INF/lib/qqq-widgetset-1.0-SNAPSHOT.jar and WEB-INF/lib/qqq-backend-1.0-SNAPSHOT.jar)

Why Delphi does not output the DCU files in the correct folder?

I have a project (C:\Test\Test.dpr) that uses a file (External.pas) belonging to library (MyLib.DPK). All files in the library are accessible via 'Search' path but I also included External.pas directly in my DPR file:
program Test;
uses
External in '..\Packages\MyLib\External.pas', <------ the 'external' file
FormMain in 'FormMain.pas' {frmMain};
For this project I set the 'Output directory' and 'Output DCU dir' to ".\$(Platform)_$(Config)".
When I compile, the exe file all DCUs of this project are written in the correct output folder: c:\Test\Win64_Debug\
However, the External.dcu is generated in ..\Packages\MyLib\External.dcu
instead of c:\Test\Win64_Debug\
Why is that?
Let me ask the question in a different way: if to a DPR project I append a PAS file that is in a different folder, shouldn't all DCU files (including the external file) be generated in the same folder as the EXE file?
From the documentation:
Output directory
Specifies where the compiler should put the executable file.
Unit output directory
Specifies a separate directory to contain the compiled units (.dcu).
It sounds like you need to specify the unit output directory as well as the output directory. Personally I tend to keep these two directories separate.
Yes the Project Options UI can be quite confusing especially because in order to access settings for each target platform you need to switch to that target platform via the dropdown list.
This part of the IDE could be made much better if you could simply see configurations for all target platforms at once.
Now if you want to be able to maintain output paths setting on one location (All configurations) you just need to make sure that specific target configurations are not overriding it.
To do so go to specific target configuration and then instead of clicking on the field entry itself click on the + sign in front of it.
This will expand current property field and also show the values from parent configurations from which this property can be inherited from.
NOTE: While many properties can indeed be inherited (property values from target configuration are added to properties from parent scheme like) Output directory and Unit output directory since they can contain only one value are simply overridden.
So in order to make sure that output locations from All configurations is used in every specific target configurations none of them should not have defined custom value for output locations.
In other words values from Release configuration - ... or Debug configuration - ... when you have specific property expanded must be empty like in the picture above.
Damn it... I did it again... I set the Target for 'All configurations - All Platforms' but the path for 'Debug config-64bit windows platform' was already set to something else. So, when I set the (correct) path in 'All configurations', the 'Debug config-64bit windows platform' remained as it was. I have 12 possible configurations (debug, release, pre-release) so I haven't seen that 'Debug config-64bit windows platform' remained set to the original value. The GUI for Project Options can cause lots of mistakes!
Thanks David. Sorry for wasting your time. I am still struggling with Delphi paths. There is nothing in the whole IDE as confusing/weird as the paths (search, output, library, etc)

IntelliJ refusing to copy text file to the compiled classes folder

The URL below is null, and a null pointer is resulted at "toURI()".
URL u = getClass().getClassLoader().getResource("res/root.txt");
File f = new File(u.toURI());
Scanner sc = new Scanner(f);
I've looked in out/production/MyProject/res and the .txt file is not there. I've tried rebuilding and compiling the project, but nothing so far has made IntelliJ think the .txt file is required. >_>
I've also tried having a look at preferences, though I'm not sure what I'm looking for, the compiler doesn't have anything set to be ignored so I don't know.
Any ideas?
P.S. my operating system is Mac OSX if that helps
In IDEA, Project Settings > Compiler lists resource patterns corresponding to files that will be copied to the compile output path.
By default, files with the .txt extension are not included, so you will simply need to add the corresponding pattern to that list for your project.

Delphi can't find System.dcu; what should the default path settings be?

Got this error whenever I try to compile something: "F1027 Unit not found: 'System.pas' or binary equivalents (.dcu)".
Got it after installing a component, removed it, reinstalled RAD studio, but still same.
In order to get it fixed, I need the Library path and browsing path. Please anybody post yours so I get it working.
A workaround I found is including the path "$(BDS)\lib\win32\debug" to Library path, but this is not the correct way. So I need your paths. Thanks!
This is from the HKLM\Software\Embarcadero\BDS\8.0\Library key in the registry - you can save it to a .reg file and then import it (making any necessary fixes to the paths first, of course):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Embarcadero\BDS\8.0\Library]
"Browsing Path"="$(BDS)\\SOURCE\\VCL;$(BDS)\\source\\rtl\\common;$(BDS)\\SOURCE\\RTL\\SYS;$(BDS)\\source\\rtl\\win;$(BDS)\\source\\ToolsAPI;$(BDS)\\SOURCE\\IBX;$(BDS)\\source\\Internet;$(BDS)\\SOURCE\\PROPERTY EDITORS;$(BDS)\\source\\soap;$(BDS)\\SOURCE\\XML;$(BDS)\\source\\db;$(BDS)\\source\\Indy10\\Core;$(BDS)\\source\\Indy10\\System;$(BDS)\\source\\Indy10\\Protocols;$(BDS)\\source\\database;"
"Debug DCU Path"="$(BDSLIB)\\$(Platform)\\debug;$(BDS)\\RaveReports\\Lib"
"HPP Output Directory"="$(BDSCOMMONDIR)\\hpp"
"Language Library Path"="$(BDSLIB)\\$(Platform)\\release\\$(LANGDIR);$(BDS)\\lib\\$(LANGDIR)"
"Package DCP Output"="$(BDSCOMMONDIR)\\Dcp"
"Package DPL Output"="$(BDSCOMMONDIR)\\Bpl"
"Package Search Path"="$(BDSCOMMONDIR)\\Bpl"
"Translated Debug Library Path"="$(BDSLIB)\\$(Platform)\\debug\\$(LANGDIR)"
"Translated Library Path"="$(BDSLIB)\\$(Platform)\\release\\$(LANGDIR)"
"Translated Resource Path"="$(BDSLIB)\\$(Platform)\\release\\$(LANGDIR)"
"Search Path"="$(BDSLIB)\\$(Platform)\\release;$(BDSUSERDIR)\\Imports;$(BDS)\\Imports;$(BDSCOMMONDIR)\\Dcp;$(BDS)\\include;C:\\Program Files\\Raize\\CS4\\Lib\\RS-XE;;$(BDS)\\RaveReports\\Lib"
For MSBuild to work properly (and for project configurations), you need to make sure the following environmental variable is set properly:
PLATFORM=ANYCPU
Top Line of the library path:
$(BDSLIB)\$(Platform)\release
Some installers mistakenly parse this as two lines and split them out.
Check on your Delphi IDE menu: Tools * Options, to see what is defined.
My default installation has 2 important "Environment Variables",
BDSLIB, defined as "c:\program files\embarcadero\rad studio\8.0\lib"
Platform, defined as "Win32".
On that same form, under Library, is defined
Library path:, the path begins "$(BDSLIB)\$(Platform)\release;...
That should equate to C:\program files\embarcadero\rad studio\8.0\lib\Win32\release", which is where you should find System.dcu. Make sure that file is there. Maybe it was removed or damaged by your component work.
There is also a "Debug" directory under Win32 which should have the dcu with the debug information included. If the release dcu is missing or damaged, you can probably copy the debug version in as a quick test.
It sounds like the compiler couldn't find the dcu then also looked for the source file to recreate it. But it should normally use the dcu.
I believe the source is in PF\Embarcadero\Rad Studio\8.0\source\rtl\sys as system.pas.
All of the above is the default Delphi Options. The options can also be changed for a project, which could interfere with the above. Try the above first. Then create a new project and see if it will complile, as that will use the defaults only.
Patrick
New York
Take a look at the -cleanregistryide option on this page:
http://support.embarcadero.com/es/article/42597
It will allow you to restore the IDE's default installation paths. If you use this option, third-party add-in's would need to be reinstalled. I have experienced this problem after upgrade installations when there were installed 3rd party IDE tools.
HTH
Navid
For XE4 use this restore.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\Library\Win32]
"Search Path"="$(BDS)\Imports;$(BDSCOMMONDIR)\Dcp;$(BDS)\include;C:\Program Files (x86)\Embarcadero\RAD Studio\11.0\lib;C:\Program Files (x86)\Embarcadero\RAD Studio\11.0\include;C:\Program Files (x86)\Embarcadero\RAD Studio\11.0\Imports;$(BDSLIB)\$(Platform)\release;$(BDSUSERDIR)\Imports;$(BDS)\Imports;$(BDSCOMMONDIR)\Dcp\$(Platform);$(BDS)\include"
You can change 11.0 to your version of Delphi

Resources