Forum > General

Can't load resources from a trivial program

<< < (3/3)

That syntax is indeed the one to use. It also works for .lpr. It may be that for the .res part it is not necessary, but it is for the .rc part.
Personally I use the quotes for both.

In effect it tells the - resource - compiler to first compile the .rc file, which is a text file, to binary format and then use the generated res file to compile the final result.
Note that when you change the .rc file you need a rebuild, not just a recompile.
People may be confused about that: if a res file is already present, that will be used on a simple recompile, hence you need to fully rebuild your program after an rc file is editted.

This feature is Delphi compatible and I wrote an article about this feature for the legendary UNDU in 1999/2000 so nay 24 years old and still relevant.
I also lobbyed for including this in Lazarus/FPC.
You can still find more info on (in Dutch).

Thanks for the explanations. That was helpful.

RE: Quotes-It may be that for the .res part it is not necessary, but it is for the .rc part. Personally I use the quotes for both.

That gets me back to my original post. For some reason I cannot write the most trivial pascal program which will compile a .rc file. I can remove the quotes and get it to compile without a duplicate error, but it doesn't generate a .res file.

RE: Using {$R 'shadersrc.res' '..\libraries\common\shadersrc.rc' in my .dpr

A .dpr file is new to me. Is it (roughly) a pascal file that is compiled in Delphi compatibility mode? Using a second argument in my pascal file doesn't have any affect.

dpr is delphi or delphi mode. lpr is for Lazarus, but also suitable for delphi mode. Both contain the main program.
Note you need to put a space between the quotes res and quoted rc! Otherwise it might be (is) interpreted as a concatenation.

Thanks, I've learned a lot.

I tried all of the suggestions and have gotten the large program to compile and run which is a major victory. I still haven't gotten a simple pascal program which will compile and run under Lazarus on my PC which will convert a resource file (.rc) to a .res file. I can provide my programs to other Lazarus user's, and they are able to do that with no issue. Oh well! I've got other challenges to deals with.


[0] Message Index

[*] Previous page

Go to full version