Recent

Author Topic: Bad practices - a short story  (Read 572 times)

bobby100

  • Sr. Member
  • ****
  • Posts: 260
    • Malzilla
Bad practices - a short story
« on: June 30, 2024, 12:16:08 pm »
Yesterday, I've learned something new - how to do some things wrong.
I'll present the symptoms first, and let you think about the possible cause, and at the end I'll present the cause of the problem.

Preface: I am creating some visual components - make a basic skeleton, install into the Lazarus IDE, create a test app (a form with this one component on it), add functions, properties etc. see if it is OK. At some point install the component again, develop further etc. Testing it by compiling the test app etc.

And after some work done, this happens when I try to compile:
Code: [Select]
Hint: (11030) Start of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Hint: (11031) End of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 3.2.2 [2024/05/25] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling BCLeaBoard.lpr
(3104) Compiling untboard.pas
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\untboard.pas(40,28) Hint: (5024) Parameter "Sender" not used
(9022) Compiling resource C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\lib\x86_64-win64\BCLeaBoard.obj
(9015) Linking C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.exe
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "PASCALMAIN"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "main"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "INITFINAL"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "FPC_THREADVARTABLES"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "FPC_RESOURCESTRINGTABLES"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "FPC_WIDEINITTABLES"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "FPC_RESSTRINITTABLES"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "__heapsize"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "__fpc_valgrind"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: (9209) Multiple defined symbol "$unwind$main"
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Error: Undefined symbol: VMT_$BCLEABOARD_$$_TBCLEABOARD$indirect
C:\Users\Bobby\Documents\Lazarus\BGRAControls\bgracontrols\test\test_bclea\BCLeaBoard.lpr(24,1) Fatal: (10026) There were 11 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus\fpc\3.2.2\bin\x86_64-win64\ppcx64.exe returned an error exitcode
Re-start Lazarus, install the component again - does not help.
Create a new test app - it works again.
Save the test app, compile again - error is back.

And here is the source of the problem (select the text to see it):
I gave the component and the test-app the same name - BCLeaBoard. The compiler creates two obj files with the same name, one in the component directory and the other in test-app directory. The Linker says - go home, you drunk

Bart

  • Hero Member
  • *****
  • Posts: 5467
    • Bart en Mariska's Webstek
Re: Bad practices - a short story
« Reply #1 on: June 30, 2024, 11:18:36 pm »
Nice one!

 

TinyPortal © 2005-2018