Forum > General

Compiler Error

(1/3) > >>

Newmann:
Hey guys,
I'm getting a weird error when compiling a little project that I'm working on. It seems to find some kind of a problem in my resource file- take a look at the following:


--- Code: ---program textCan;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, main, about, compare, daily;

{$IFDEF WINDOWS}{$R textCan.rc}{$ENDIF} {<<== GETTING ERROR HERE}

begin
  Application.Title:='TxtCan';
  Application.Initialize;
  Application.CreateForm(Tfrm_main, frm_main);
  Application.Run;
end.

--- End code ---

The error messages that it kicks out is:

--- Quote ---Compiling resource C:\Development\prj-textCan\textCan.rc
c:\lazarus\fpc\2.2.4\bin\i386-win32\windres.exe: C:/DEVELO~1/PRJ-TE~1/textCan.rc:4: syntax error
textCan.lpr(19,1) Error: Error while linking
textCan.lpr(19,1) Fatal: There were 1 errors compiling module, stopping

--- End quote ---

I tried deleting that file and recreating it- no effect. Does anybody have any idea what causes this to happen? If I simply comment the line out the program compiles 100%...just doesn't have any application icons then...

Leledumbo:
Try compiling the .rc manually, if that works, then the problem isn't the .rc file.

Newmann:
I actually deleted all the files in my project folder except for the *.lpr, *.lpi, and *.pas files, then did a full build so it can re-create all the files from scratch...still get the error.

How do I compile the .rc file manually? I have a program called Resource Builder that I used with Delphi and it worked like a dream- can I use that instead?

Leledumbo:

--- Quote ---How do I compile the .rc file manually?
--- End quote ---
Try fpcres (or windres) xxx.rc

Lush:
I had the same kind of problem twice, yesterday and today.

Once with 0.9.28, just a compiler error pointing to the {$IFDEF WINDOWS} directive in the .lpr file

Once with 0.9.31-29660, the compiler error pointing to the .lrs file, saying something about "LazarusResources" not being valid.

In both cases I had loaded a 128x128 PNG icon (a different icon every time) in the Project Options.

With other 128x128 icons it works fine, without even generating a {$IFDEF WINDOWS} directive.
(and why would Windows be the only OS that can display an icon anyway?)

So I suspect those two PNGs had some special metadata or something corrupt with them that made the icon importer go weirdo somehow...

Navigation

[0] Message Index

[#] Next page

Go to full version