Forum > General

Can't load resources from a trivial program

(1/3) > >>

bobc50:
I've seen some similar questions but can't apply the answers to this simple problem. I'm running Version: 2.2.2, FPC Version 3.2.2, Revision: lazarus_2_2_2, i386-win32-win32/win64. I created a new application and add one line, {$R 'CheckBox1.rc'} after {$mode objfpc}{$H+}. Code is below. CheckBox.rc is in the same folder as the project and contains the one line:
CHKBOX BITMAP TICKCHK1.BMP
TICKCHK1.BMP is also in the same folder.

When I compile with -vd I get the following messages:
Compile Project, Target: project1.exe: Exit code 1, Errors: 1, Warnings: 2
Warning: windres [option(s)] [input-file] [output-file]
Warning: windres: supported targets: pe-i386 pei-i386 elf32-i386 elf32-iamcu elf32-little elf32-big pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big plugin srec symbolsrec verilog tekhex binary ihex
unit1.pas(28,0) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.

I've had another programmer follow the exact same steps and they had no issue. How can I troubleshoot/fix this problem?




--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+}{$R 'CheckBox1.rc'}// this is how the TickChk.bmp file gets included interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs; type  TForm1 = class(TForm)  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} end.    

jamie:
try putting that down in the Implementation section instead.

bobc50:
Thanks, but unfortunately that made no difference. The messages are identical.

jamie:
Not but I normally recompile the *.RC to a *.res file and include that instead.

However, have you tried going to the project inspector in the Project menu and add it there ?

bobc50:
Thanks again for trying to help!

I tried your suggestion about add the rc file to the project inspector and it compiled with no errors. This small test case was designed to trouble shoot a compile problem in a very large program. I went back to the project inspector and add the three rc files and the large project built but when I went to run it I got error messages indicating that the resource checkbox was not found. That message is identical to what I got when I commented out the rc lines in the appropriate .pas files so that I could compile the whole project and then built it.

You suggested compiling the rc file to a res file and including that. I tried adding them via the project inspector and got the same results as above.

Let me try a be a bit clearer in the larger problem I'm trying to solve.

I've got a very large program. One of the components in that program is a package file. One of the .pas files in that package file had one {$R...} lines and another had two. Following your suggestions, I hope, I've removed those lines and then rebuilt the package file using the project inspector to add the three .rc files I had commented out. I then tried to build the major project and if failed, not finding one of the rc file, specifically checkbox.rc. I tried the same set of steps removing the rc files from the project build and adding the corresponding .res files and the same error occurred.

I hope that makes sense and hope I've followed your advice and would appreciate some other trouble shooting steps.

I am a long-time programmer but new to both Pascal and Lazarus. Are there a few lines of code that I can add to a new application that would allow me to know if the resource was actually present? There is little I can do with the large project to provide an example.

Navigation

[0] Message Index

[#] Next page

Go to full version