Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

About {$R *.res}...

15 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John vd Waeter

Hi All,

To polish my application (WinCE, KOL-CE) I wanted to add an icon to the executable.

I was suggested to create a resource-file in Delphi, add a Mainicon to it and copy the res-file in my application source dir.

After that, I inserted a {$R *.res} in the .lpr et voila, after compiling my app showed a beautiful icon.

But... after quitting and restarting Lazarus and opening my projectfile, the IDE outcomments the resource-directive:

{$R *.res} becomes
//{$R *.res}

It looks like using a resourcefile this way is allowed by the compiler (2.2.0) but not allowed by the IDE?

tnx,
John

Reply by email

Bart
to John vd Waeter
John vd Waeter wrote 22 lines
Hi All, To polish my application (WinCE, KOL-CE) I wanted to add an icon to the executable. I was suggested to create a resource-file in Delphi, add a Mainicon to it and copy the res-file in my application source dir. After that, I inserted a {$R *.res} in the .lpr et voila, after compiling my app showed a beautiful icon. But... after quitting and restarting Lazarus and opening my projectfile, the IDE outcomments the resource-directive: {$R *.res} becomes //{$R *.res} It looks like using a resourcefile this way is allowed by the compiler (2.2.0) but not allowed by the IDE? I think you have to specify the filename (not *.res, but

myresourcewithicon.res), at least that works for me here (on win9x).

Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081008/b1b387b7/attachment.html

Reply by email

Felipe Monteiro de Carvalho
to John vd Waeter: To polish my application (WinCE, KOL-CE) I wanted to add an icon to the executable. I was…
John vd Waeter wrote 5 lines
To polish my application (WinCE, KOL-CE) I wanted to add an icon to the executable. I was suggested to create a resource-file in Delphi, add a Mainicon to it and copy the res-file in my application source dir.

This isn't a good idea. The .res format used by borland ist not the same one used by Free Pascal (which is the GNU format). They are not compatible and linking would fail.

You can instead create a .rc file and add it with {$R myrcfile.rc}

Here is an example:

http://magnifier.svn.sourceforge.net/viewvc/magnifier/trunk/magnifier.rc?revision=42&view=markup

http://magnifier.svn.sourceforge.net/viewvc/magnifier/trunk/resource.h?revision=42&view=markup

I don't remember exactly which icon will be set for the mainicon... maybe the lower ID one?

Note that this doesn't answer your question. I don't know why the IDE is commenting your {$R }.

Felipe Monteiro de Carvalho

Reply by email

Osvaldo TCF - Listas
to Felipe Monteiro de Carvalho

When i try crosscompile linux to win32 i have this error: vsab.lpr(20,1) Error: resource compiler not found, switching to external mode

The problem is with this:
{$IFDEF WINDOWS}{$R vsab.rc}{$ENDIF}

I can't disable this!

Felipe Monteiro de Carvalho wrote 25 lines
On Wed, Oct 8, 2008 at 3:28 AM, John vd Waeter wrote: > To polish my application (WinCE, KOL-CE) I wanted to add an icon to the > executable. > > I was suggested to create a resource-file in Delphi, add a Mainicon to > it and copy the res-file in my application source dir. This isn't a good idea. The .res format used by borland ist not the same one used by Free Pascal (which is the GNU format). They are not compatible and linking would fail. You can instead create a .rc file and add it with {$R myrcfile.rc} Here is an example: http://magnifier.svn.sourceforge.net/viewvc/magnifier/trunk/magnifier.rc?revision=42&view=markup http://magnifier.svn.sourceforge.net/viewvc/magnifier/trunk/resource.h?revision=42&view=markup I don't remember exactly which icon will be set for the mainicon... maybe the lower ID one? Note that this doesn't answer your question. I don't know why the IDE is commenting your {$R }.

Reply by email

Paul Ishenin
to Osvaldo TCF - Listas
Osvaldo TCF - Listas wrote 9 lines
When i try crosscompile linux to win32 i have this error: vsab.lpr(20,1) Error: resource compiler not found, switching to external mode The problem is with this: {$IFDEF WINDOWS}{$R vsab.rc}{$ENDIF} I can't disable this!

As a temporary solution clear a project icon, remove manifest usage and dont use version infomation. We will try to find better solution soon.

Best regards,
Paul Ishenin.

Reply by email

John vd Waeter
to Felipe Monteiro de Carvalho: This isn't a good idea. The .res format used by borland ist not the same one used by Free…

Hi Felipe, Bart,

Weird...

> This isn't a good idea. The .res format used by borland ist not the > same one used by Free Pascal (which is the GNU format). They are not > compatible and linking would fail.

Linking worked, I guess, no erros and I saw my icon...

And Barts suggestion also worked... specify the filename instead of * and the IDE leaves it untouched...

But thanks for the links... :-)

John

Reply by email

Osvaldo TCF - Listas
to Paul Ishenin

r16930
=======================messages========================================= pj11.lpr(17,1) Error: resource compiler not found, switching to external mode
pj11.lpr(17,1) Error: Can't open object file: fpc-res.or pj11.lpr(17,1) Fatal: There were 2 errors compiling module, stopping =======================================================================

What is: "object file: fpc-res.or" ?

Paul Ishenin wrote 18 lines
Osvaldo TCF - Listas wrote: > When i try crosscompile linux to win32 i have this error: > vsab.lpr(20,1) Error: resource compiler not found, switching to external > mode > > The problem is with this: > {$IFDEF WINDOWS}{$R vsab.rc}{$ENDIF} > > I can't disable this! > Try r16928. Best regards, Paul Ishenin. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Osvaldo TCF - Listas
to Paul Ishenin: Try r16928. Paul Ishenin.

Ubuntu 8.04.1
Lazarus svn 0.9.27.16930 GTK2
FPC 2.2.3 (svn)

New application with a button and a bitbtnI get this errors/messages:

Note: No option inside /usr/lib/fpc/fpc-cross.cfg config file
crossp.lpr(17,1) Error: resource compiler not found, switching to
external mode
crossp.lpr(17,1) Error: Can't open object file: fpc-res.or
crossp.lpr(17,1) Fatal: There were 2 errors compiling module, stopping
Paul Ishenin wrote 18 lines
Osvaldo TCF - Listas wrote: > When i try crosscompile linux to win32 i have this error: > vsab.lpr(20,1) Error: resource compiler not found, switching to external > mode > > The problem is with this: > {$IFDEF WINDOWS}{$R vsab.rc}{$ENDIF} > > I can't disable this! > Try r16928. Best regards, Paul Ishenin. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Osvaldo TCF - Listas

lpr file:
================================================================ program crossp;

{$mode objfpc}{$H+}

uses

  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { you can add units after this }, ucr1;
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
================================================================

Ubuntu 8.04.1
Lazarus svn 0.9.27.16930 GTK2
FPC 2.2.3 (svn)

New application with a button and a bitbtnI get this errors/messages:

Note: No option inside /usr/lib/fpc/fpc-cross.cfg config file
crossp.lpr(17,1) Error: resource compiler not found, switching to
external mode
crossp.lpr(17,1) Error: Can't open object file: fpc-res.or
crossp.lpr(17,1) Fatal: There were 2 errors compiling module, stopping
Paul Ishenin wrote
Osvaldo TCF - Listas wrote: > When i try crosscompile linux to win32 i have this error: > vsab.lpr(20,1) Error: resource compiler not found, switching to

external

Show quoted text 15 lines
> mode > > The problem is with this: > {$IFDEF WINDOWS}{$R vsab.rc}{$ENDIF} > > I can't disable this! > Try r16928. Best regards, Paul Ishenin. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Brad Campbell
to Osvaldo TCF - Listas
Osvaldo TCF - Listas wrote
>> When i try crosscompile linux to win32 i have this error: >> vsab.lpr(20,1) Error: resource compiler not found, switching to external >> mode

Which resource compiler do you have installed?

brad at bklaptop2:/opt/cross/bin$ ls -la *windres* -rwxr-xr-x 1 brad brad 2325135 2008-09-24 15:59 i386-mingw32-windres lrwxrwxrwx 1 brad brad 20 2008-10-04 17:04 i386-win32-windres -> i386-mingw32-windres

I had to make the latter symbolic link to get it to work here.

Regards,
Brad

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish.

Reply by email

Osvaldo TCF - Listas
to Brad Campbell

This:

osvaldo at osvaldo-laptop:/usr/bin$ ls -l *windr*
-rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 i386-win32-windres -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 windres osvaldo at osvaldo-laptop:/usr/bin$

Brad Campbell wrote 16 lines
Osvaldo TCF - Listas wrote: >>> When i try crosscompile linux to win32 i have this error: >>> vsab.lpr(20,1) Error: resource compiler not found, switching to > external >>> mode Which resource compiler do you have installed? brad at bklaptop2:/opt/cross/bin$ ls -la *windres* -rwxr-xr-x 1 brad brad 2325135 2008-09-24 15:59 i386-mingw32-windres lrwxrwxrwx 1 brad brad 20 2008-10-04 17:04 i386-win32-windres -> i386-mingw32-windres I had to make the latter symbolic link to get it to work here. Regards, Brad

Reply by email

Paul Ishenin
to Osvaldo TCF - Listas

Osvaldo TCF - Listas write:

Show quoted text 7 lines
This: osvaldo at osvaldo-laptop:/usr/bin$ ls -l *windr* -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 i386-win32-windres -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 windres osvaldo at osvaldo-laptop:/usr/bin$

update your lazarus and remove this ifdef {$IFDEF windows}{$R xxx.rc}{$ENDIF} - it should not apper once again until you change something with icon, manifest or version info.

Best regards,
Paul Ishenin.

Reply by email

Osvaldo TCF - Listas
to Paul Ishenin

Not OK!

No icon, no version ...

Note: No option inside /usr/lib/fpc/fpc-cross.cfg config file
crossp.lpr(18,1) Error: resource compiler not found, switching to
external mode
crossp.lpr(18,1) Error: Can't open object file: fpc-res.or
crossp.lpr(18,1) Fatal: There were 2 errors compiling module, stopping

Windres

osvaldo at osvaldo-laptop:/usr/bin$ ls -l *windr*
-rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 i386-win32-windres -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 windres osvaldo at osvaldo-laptop:/usr/bin$

projetc file crossp.lpr

program crossp;
{$mode objfpc}{$H+}

uses

  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { you can add units after this }, ucr1;
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Paul Ishenin wrote 18 lines
Osvaldo TCF - Listas write: > This: > > osvaldo at osvaldo-laptop:/usr/bin$ ls -l *windr* > -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 i386-win32-windres > -rwxr-xr-x 1 root root 2808262 2008-10-07 22:01 windres > osvaldo at osvaldo-laptop:/usr/bin$ > update your lazarus and remove this ifdef {$IFDEF windows}{$R xxx.rc}{$ENDIF} - it should not apper once again until you change something with icon, manifest or version info. Best regards, Paul Ishenin. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email