I am working through the help files and keep having troubles with building the projects.
I am typing in the tutorials word for word but keep getting the same error where the variable is not explicitly defined
LET a$="My"
LET b$="favourite number: "
LET c= 7
LET c$=a$ + " " + b$ + " : " + c
PRINT c$,0,20
SHOWSCREEN
Output
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.10.074 SN:6756c99f - 2D, WIN32
"tut3.gbas"(21) warning : probably unassigned variable : a$
"tut3.gbas"(21) warning : probably unassigned variable : b$
"tut3.gbas"(21) warning : probably unassigned variable : c
"tut3.gbas"(23) warning : probably unassigned variable : c$
"tut3.gbas"(21) error : variable is not explicitly defined : a$
Can't figure out where I am going wrong. Any help would be appreciated.
Running windows 7 64 bit.
Hi,
http://www.glbasic.com/forum/index.php?topic=5899.msg46482#msg46482
http://www.glbasic.com/forum/index.php?topic=5677.msg44603#msg44603
http://www.glbasic.com/forum/index.php?topic=4899.msg37376#msg37376
..and many many more answers to the same question. :)
Welcome in the Forum nadthevlad
1. LET ist very, very outdated dont use it.
2. Explicit declaration is on. This means you are forced to either use LOCAL or GLOBAL (or constant) to define a variable. Look for these both commands in the manual, to see which one you need.
Or go to Project->Options and deselect explicit declaration, in this case all variables are automatic defined as global if you dont define them. But i recommend to all ways define variables by yourself, so you know what is happening. And i recommend to keep explicit declaration enabled, so you are always forced to define variables before you use them, so you can easier find misspelled ones.
BTW: the manual is really old and outdated in some parts... e.g. now there 3 types of variables: strings (a$), integer (a%) and floats (a# or just a) if you dont select a type its always a float, integer are fast, so use integer, if possible.
There is a GLB wiki, that you can check, there are tutorials too (most is the same like the manual -> outdated, but some new+nice parts are there): http://wiki.just-do-i-t.com/index.php?title=GLBasic_Wiki
Feel free to ask any question that you may have.
Regards.
EDIT: darn monono was faster. :O
Thanks for the quick replies.
I've got it now.