Windows 7 64-bit using ThinBasic 1.13.0.0 and I cannot reproduce your issue.
I get Error Code 146: "Variable name already defined (Duplicated generic)".
I wrote a ThinBasic program but declared a variable twice by mistake, such as the following:
Dim Status As Integer
Dim Status As Integer
I ran the program and the program terminated immediately with no error message.
Can duplicate declarations be detected at runtime and an error message displayed?
Eric
Windows 7 64-bit using ThinBasic 1.13.0.0 and I cannot reproduce your issue.
I get Error Code 146: "Variable name already defined (Duplicated generic)".
I am using Windows 11 x64.
Here is a script that shows the issue (at least for me).
No output will be printed. Momentary terminal window flashes, then closes.
created another simple console script, same problem.' File DupVarBug.tbasicc ' OS: Windows 11 64 bit '---Load Console Module Uses "Console" Dim Status as Integer Dim Status As Integer Status = 1 Printl Status '---Wait for a key press WaitKey
' File: Hello.tbasicc '---Load Console Module Uses "Console" Dim Status as Integer Dim Status As Integer '---Print the magic words 'PrintL "Hello World from ThinBASIC!" 'PrintL 'PrintL "Press a key to end program" Printl "Hello" '---Wait for a key press WaitKey
Last edited by EricE; 07-10-2025 at 16:39.
More info:
The problem, no error message being generated, arises if the script is saved with the "tbasicc" extension.
Running the code with the *.tbasicc extension in a console also gives an error. If you single step the code with the debugger it will stop after executing (or trying to) the duplicate variable definition.
Thanks a lot for reporting.
I will have a look in the week-end, currently out for work.
I remember that some way long I decided not to give any error if the duplicated variables was exactly the same name and same type so just ignore it.
And later I decided it was not a good idea.
For sure no crash should happen.
Script extension (.tbasic or tbasicc) should not made any change.
Extension is used to understand if to execute in a Windows environment (including the possibility to have a side Console) or in a pure Console environment.
Last edited by ErosOlmi; 08-10-2025 at 16:50.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Just a quick test under thinBasic 1.14 but should be the same with previous thinBasic versions.
Confirm the the variable duplication error is trapped
But file extension is preventing to show runtime error in console for .tbasicc script files.
When using .tbasicc files, script is executed by thinBasicc.exe application and error reporting is sent to standard error output (that is the console itself) but without any stop to wait for user input and have time to see error
.tbasicc is mainly for input/output pipelines.
It was developed when we thought that thinBasic could be used as server side web scripting language like PHP. Now abandoned dream, there are so many good programming languages out there for that purpose.
Attached an example on how executed the script from a command line and how you can see trapped error
So, just use .tbasic extension even for Console script and use .tbasicc when no user interface at all is needed
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000