Recent

Author Topic: [solved] Error Duplicate resource: Type = 10  (Read 2892 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1079
[solved] Error Duplicate resource: Type = 10
« on: September 12, 2022, 08:45:44 am »
Code: Pascal  [Select][+][-]
  1. Error: Duplicate resource: Type = 10, Name = TFRAME_MEINTAG, Lang ID = 0000
  2. project1.lpr(29,1) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.

I read the above error messages and cannot get rid of it. My project does not compile any more.

These I tried in vain and the error messages look the same:

- compiling with -vd
- removing TFrame_MeinTag from the project
- searching for it in all files of the project
- deleting the res-file and restarting Lazarus
- searching this forum and finding
https://forum.lazarus.freepascal.org/index.php/topic,25727.msg156630.html#msg156630
https://forum.lazarus.freepascal.org/index.php/topic,29035.msg182685.html#msg182685

I cannot find this "duplicate" anywhere.
Help would be very appreciated.
« Last Edit: September 12, 2022, 05:45:09 pm by Nicole »

dbannon

  • Hero Member
  • *****
  • Posts: 3319
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Error Duplicate resource: Type = 10
« Reply #1 on: September 12, 2022, 09:18:43 am »
Did you look at line 29 of the lpr file ?  Might be worthwhile posting the file if it has nothing sensitive in it (do check first!).

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Nicole

  • Hero Member
  • *****
  • Posts: 1079
Re: Error Duplicate resource: Type = 10
« Reply #2 on: September 12, 2022, 09:33:38 am »
At line 29 is "nothing".
Just
"end."
Below is the full file.
This "duplicate" "Frame_MeinTag" is already removed.

Code: Pascal  [Select][+][-]
  1. program project_Tiger;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   {$IFDEF HASAMIGA}
  10.   athreads,
  11.   {$ENDIF}
  12.   Interfaces, // this includes the LCL widgetset
  13.   Forms, datetimectrls, printer4lazarus, unit_Tiger, frame_berichte_, frame_margin_, unit_Zeit,
  14.   DB_Modul_, frame_waren_, Frame_Zeitzonenrechner_, sortieren_, Typen_LiesCSI,
  15.   Typen_und_Vars, Daten_filtern_und_rechnen, Trades_Details, Tradeauswertung,
  16.   tachartlazaruspkg, zcomponent, frame_korrelationen_, DB_Kontrakte_,
  17.   frame_CSI_, Frame_Kalender_, frame_news_, db_konto_, Frame_Konto_, Frame_Kontoinfo_;
  18.  
  19. {$R *.res}
  20.  
  21. begin
  22.   RequireDerivedFormResource:=True;
  23.   Application.Scaled:=True;
  24.   Application.Initialize;
  25.   Application.CreateForm(TForm_Tiger, Form_Tiger);
  26.   Application.CreateForm(TDB_Modul, DB_Modul);
  27.   Application.CreateForm(TDB_Kontrakte, DB_Kontrakte);
  28.   Application.Run;
  29. end.

egsuh

  • Hero Member
  • *****
  • Posts: 1594
Re: Error Duplicate resource: Type = 10
« Reply #3 on: September 12, 2022, 09:48:10 am »
Maybe you are including two units, which has the same frame name "TFrame_Meintag".  For me this happened when I upgraded version --- like copying folder_ver_1\unit_1.pas to  folder_ver_2\unit_2.pas, but both units were compiled inadvertently.

Go to View>Unit dependencies>Projects and Packages, and check if any file is included that should not be.

Josh

  • Hero Member
  • *****
  • Posts: 1372
Re: Error Duplicate resource: Type = 10
« Reply #4 on: September 12, 2022, 10:21:12 am »
hi
1st thing i would do is delete/rename the lib folder in your project.
then do a run 'Clean up and Build' option, in the dialog click the delete button (bottom right), then click CleanUp and Build.

Hopefully this will help.
If not at least we have a eliminated any mismatching code in your lib folder.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Error Duplicate resource: Type = 10
« Reply #5 on: September 12, 2022, 10:31:26 am »
Just a try, i guarantee for nothing, but that way i do my projects mostly:
Code: Pascal  [Select][+][-]
  1. program project_Tiger;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   {$IFDEF HASAMIGA}
  10.   athreads,
  11.   {$ENDIF}
  12.   Interfaces, // this includes the LCL widgetset
  13.   Forms,
  14.   Form_Tiger, DB_Modul, DB_Kontrakte;
  15.  
  16. {$R *.res}
  17.  
  18. begin
  19.   RequireDerivedFormResource:=True;
  20.   Application.Scaled:=True;
  21.   Application.Initialize;
  22.   Application.CreateForm(TForm_Tiger, Form_Tiger);
  23.   Application.CreateForm(TDB_Modul, DB_Modul);
  24.   Application.CreateForm(TDB_Kontrakte, DB_Kontrakte);
  25.   Application.Run;
  26. end.

//edit
modified names again, my bad
« Last Edit: September 12, 2022, 11:01:59 am by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

dbannon

  • Hero Member
  • *****
  • Posts: 3319
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Error Duplicate resource: Type = 10
« Reply #6 on: September 12, 2022, 11:15:26 am »
At line 29 is "nothing".

Hmm, not very useful.

If you have not already tried it, certainly do the "Clean up and rebuild" thing as Josh suggests. Its first port of call when funny things happen.

Now might be a very good time to make a backup copy of all the files if you don't already have a system.

Next, eliminating some of the 'uses' items ?  No real harm with the ones not mentioned below the 'begin'. But if a two resources have the same name, its going to be bad news sooner or later. Are you using a unix like system ?  greping for that tag would be a good thing, it can be in any number of different file types, not just the .pas files. Windows must have some text search tools .....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

wp

  • Hero Member
  • *****
  • Posts: 12773
Re: Error Duplicate resource: Type = 10
« Reply #7 on: September 12, 2022, 11:40:33 am »
Here is one possible scenario which leads to this: I know that you are working with TvPlanIt, so let me construct my example around it. This package provides several images stuffed into a common resource file, vpbasepng.res. Suppose you want to show one of these images in a TImage in your own application. To get access to the resource file you add a {$R vpbasepng.res} to the unit. And this is a problem if you have a TvPlanIt unit in your uses clause which already accesses the resource file (e.g. vpdayview). Because the package itself already contains this line you are attempting to add the resource a second time.

Solution: Drop this line, simply access the resource, your application already knows that it exists and where it can be found.
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, VpDayView;
  5.  
  6. type
  7.   TForm1 = class(TForm)
  8.     Image1: TImage;
  9.     VpDayView1: TVpDayView;
  10.     procedure FormCreate(Sender: TObject);
  11.   end;
  12.  
  13. var Form1: TForm1;
  14.  
  15. implementation
  16. {$R *.lfm}
  17. //{$R vpbasepng.res}   // THIS LINE MUST NOT BE INCLUDED!
  18.  
  19. procedure TForm1.FormCreate(Sender: TObject);
  20. begin
  21.   Image1.Picture.LoadFromResourceName(HINSTANCE, 'VPCANCEL16');
  22. end;
  23.  
  24. end.

Nicole

  • Hero Member
  • *****
  • Posts: 1079
Re: Error Duplicate resource: Type = 10
« Reply #8 on: September 12, 2022, 05:15:41 pm »
Thank you all for the answers, hm, bad news here, which reads: "error 10" ;-(

1) I have done this "clean and rebuild" several times without success
2) As i know myself as DAU, I backup my files every some hours in a complete directory to rename and switch back. Although I want much to avoid this at the moment, because I would lose - some hours of work.
3) Very interesting is the thing "look for not wanted items in your list". I see a ghost called datamodule1 on clicking "Forms", there it is listed. I have no idea, where it comes from. There seems to be no unit or ressource connected to it. this "datamodule1" is not in the list of project contents neither.
4) I do not work with tvPlanit at the moment. In this project, I will generate the calendar frame later. The tricky thing is, that I have a looong TPageControl with one or two frames for every Tabsheet. Those frames are all nested. I would like to clean up those uses clauses: However, I do not know how. Interface and implementation: there are uses clauses to lots of frames. And I do not think, there are too many not needed.
5) Once upon a time, in a country far away, I had such a problem with Delphi. An error-message about an element I could not find anywhere. I used a text-editor to find it in a file and just forced it by ASCII. Unfortunately I cannot remember which was the name in Delphi, nor I have an idea, if there is such a file in Lazarus and how it may be called.

Perhaps I can start it by the question:
This "datamodule1", where may it come from?

and PS:
"datamodule1" is not found by a text search in any file of my project.
« Last Edit: September 12, 2022, 05:21:51 pm by Nicole »

dseligo

  • Hero Member
  • *****
  • Posts: 1503
Re: Error Duplicate resource: Type = 10
« Reply #9 on: September 12, 2022, 05:41:10 pm »
3) Very interesting is the thing "look for not wanted items in your list". I see a ghost called datamodule1 on clicking "Forms", there it is listed. I have no idea, where it comes from. There seems to be no unit or ressource connected to it. this "datamodule1" is not in the list of project contents neither.

This 'datamodule1' is probably your problem.
If you say you don't have it anywhere in your sources, then go to 'Project option' and then check tab 'Paths' if here is something that shouldn't be. It could be that you have some path included with this datamodule1.

Nicole

  • Hero Member
  • *****
  • Posts: 1079
Re: Error Duplicate resource: Type = 10
« Reply #10 on: September 12, 2022, 05:44:51 pm »
This datamodule1 remains a riddle.

The not-compiling problem is solved, here is how:

these I tried before without success:
- I removed all "frame_meinTag"-files from the project
- I deleted the directory x86_64-win64


This DID help (all files mentioned are " Frame_meinTag.* ")
- I found the files in the root directory *.pas and *.lfm, I deleted them and restarted Lazarus
- For the first time I saw the error message "files are missing" instead of "files are duplicate"
- I did a "test" of the project from the debugger-menue
- there suddenly were found "lost files" in the x86_64-win64
*.o
*.ppu

- and there I found one more file, called
*.lfm (this is thrilling, because the *lfm does not belong anywhere, so there were probagly 2 *lfms in 2 direcotries, on in the root and one in the lib)

I deleted them all.
Suddenly "Frame_MeinTag" appeared in the uses clause again, where it had not been before.
I deleted it there as well.

The project compiles again.

PPS: NOW I have it!
I worked on and tried to re-add the Frame_meinTag... and re-added the problem.
I deleted all the stuff again and had a very close look at the file:
{$R *.lfm}

was double!
So I am afraid, if the compiler generated TWO lfms, this was it, what I had told him.


« Last Edit: September 12, 2022, 07:51:03 pm by Nicole »

 

TinyPortal © 2005-2018