views:

1109

answers:

1

Hi,

I have a problem migrating from Delphi 2006 to Delphi 2009. A Project which uses the JVCL complains that jvconsts.res is missing. The file is definitly there. The project search path includes the directory where the file is located. (Note: I don't have JVCL in my global search path to make it more portable)

But the file should be found, as the Delphi Help says:

"... the linker searches for .res files [...] in the directories specified in the Search path input box on the Directories/Conditionals page of the Project|Options dialog box"

This is not a JVCL problem: A minimalistic program shows this:

Imagine this directory structure:

C:\Test\ResTest.dpr
C:\Test\Res\Test.res

Here is ResTest.dpr:

program ResTest;

{$R test.res} // not found even if "c:\Test\Res" is in project search path

begin
end.

This compiles fine in Delphi 2006 but not in Delphi 2009. After some searching I found, a way to tell Delphi where the file is: The gobal search path or the -R parameter using the command line compiler.

As I write this, I come closer to the real problem: In Delphi 2006 the .cfg-File includes the lines:

-I"c:\Test\Res"
-U"c:\Test\Res"
-R"c:\Test\Res"

Basicly it copies the values from the project search path into the 3 command line options and so it makes sure that the -R parameter has the right values.

In Delphi 2009 (I set the verbosity of the compiler output to "debug") I get the resulting command line from the IDE:

If the directory (c:\Test\Res) is included in the project search path:

dcc32.exe --no-config -M -Q -ID:\Sources\Temp\1\Res;"c:\program files\codegear\rad studio\6.0\Lib" -LE"C:\Users\Public\Documents\RAD Studio\6.0\Bpl" -LN"C:\Users\Public\Documents\RAD Studio\6.0\Dcp" -O"c:\program files\codegear\rad studio\6.0\Lib" -R"c:\program files\codegear\rad studio\6.0\Lib" -UD:\Sources\Temp\1\Res;"c:\program files\codegear\rad studio\6.0\Lib" -K00400000   ResTest.dpr

If the directory is included in the global search path

dcc32.exe --no-config -M -Q -ID:\Sources\Temp\1\Res;"c:\program files\codegear\rad studio\6.0\Lib";D:\Sources\Temp\1\Res -LE"C:\Users\Public\Documents\RAD Studio\6.0\Bpl" -LN"C:\Users\Public\Documents\RAD Studio\6.0\Dcp" -O"c:\program files\codegear\rad studio\6.0\Lib";D:\Sources\Temp\1\Res -R"c:\program files\codegear\rad studio\6.0\Lib";D:\Sources\Temp\1\Res -UD:\Sources\Temp\1\Res;"c:\program files\codegear\rad studio\6.0\Lib";D:\Sources\Temp\1\Res -K00400000   ResTest.dpr

Maybe its hard to see here: The difference is the -R parameter:

Local Search Path -> -R"c:\program files\codegear\rad studio\6.0\Lib"
Global Search Path -> -R"c:\program files\codegear\rad studio\6.0\Lib";D:\Sources\Temp\1\Res

So it's no wonder why it doesn't work. The local search path is not appended to the -R Parameter in Delphi 2009.

I would say, this is clearly a bug, but why seems that nobody else has this problem? I can reproduce it on all machines we use. Maybe the error only exists in the German version of Delphi 2009?

+2  A: 

A workaround is to put this in your code in stead:

{$R res\test.res}

That works on my system with Delphi 2009, both with the IDE and the command-line compiler.

(I agree that they broke existing functionality, did you add a report to Quality Central? If not, please do: http://qc.embarcadero.com/wc/qcmain.aspx)

Jeroen Pluimers
This would work with our code, but I have to modify thirdparty code (JVCL) which I really like to avoid.
Stebi
I created an entry in QualityCentral for this bug #73249
Stebi
Jeroen Pluimers