QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: xra7en on December 06, 2018, 01:26:27 am
-
This was working a little bit ago, now it all stops, I even stripped my program down to a single loop to read data using the RESTORE LABLENAME: and I end up with
c++ compilation failed check .\internal\temp\compilelog.txt
which I do and I get:
In file included from qbx.cpp:2120:0:
..\\temp\\main.txt:294:1: error: 'LABEL_COOLLABEL' does not name a type
compilation terminated due to -Wfatal-errors.
Where did this come from, and how to fix (that is if someone ran across it
-
Are you certain COOLLABEL is only being used to reference the data and not used as a variable name , type classification, etc.? If you change the RESTORE COOLLABEL and COOLLABEL: to RESTORE debugtest and debugtest:, does it work?
Pete
-
Is your data block after a sub or function?
-
I think Fell nailed it, but...
I was surprised the newest IDE does accepts DATA statements after subs but ONLY if they are unlabeled. This code compiles and runs in version 1.2
Whereas this code, with a data label, gives the exact same error message the OP reported...
I recall in QBasic, you couldn't even put data statements in subs.
Pete
-
It’s even in the wiki:
DATA fields can be placed after SUB or FUNCTION procedures, but line labels are not allowed.
http://www.qb64.org/wiki/DATA
-
Are you certain COOLLABEL is only being used to reference the data and not used as a variable name , type classification, etc.? If you change the RESTORE COOLLABEL and COOLLABEL: to RESTORE debugtest and debugtest:, does it work?
Pete
Location of "DATA/RESTORE" is not the issue. nothing changed. all i did was add another piece of data/restore
What red flag came up was that when the first error came up, i deleted the recent RESTORE statement. thinking that was causing the error(this was after I changed to restore label to several different names - and even a number), then I started deleting THAT restore and other RESTORE statements and the error persisted. Thus why I came here. sometimes a second pair of eyes will do the trick LOL!!!. So now the DATA/RESTORE statements that WERE fine, are no longer working.
-
Is your data block after a sub or function?
Not the issue - this one one additional DATA/READ/RESTORE added to the collection. thanks though!
-
I think Fell nailed it, but...
I was surprised the newest IDE does accepts DATA statements after subs but ONLY if they are unlabeled. This code compiles and runs in version 1.2
Whereas this code, with a data label, gives the exact same error message the OP reported...
I recall in QBasic, you couldn't even put data statements in subs.
Pete
The IDE I am using will produce a "correct" error if that happens. It will let me know that I cannot put a DATA statement there. This is a compile error. Something that the IDE is not catching..( Ilike the built in IDE because it formats on the fly = very nice :-)
Attached is a screeny of me putting it in the wrong place. the IDE will catch it. This is a compile error.
-
very baffling
I stripped the program down to just as it was in the beginning, and now the data section is causing that compile error, yet there just not working when they were before.
so I would like to start at the beginning:
I am not good with C++ so looking at the source will be moot for me.
what exactly does: "does not name a type" mean when it is referring to the label for data?
-
OK
just for grins I posted this data gem EVERYWHERE and it worked just fine.
Soooooooo, that is why I am trying to narrow down - what exactly does that error me in the complier
-
if anyone wants to tinker with it (its a remake of a popular BBS door from the 90's - I have have tons of remakes i've done in different languages LOL)
http://cgstation.linkpc.net/projects
-
I think another option would be to just skip the data and put it into some type of array. (too bad qb64 does not do assoc. arrays)
I'll tinker with that today and see what I come up with and post my solution here.
:-)
I have a alpha working version on itch .io if anyone wants to see exactly what it is I am trying to accomplish LOL
-
Are you sure you don't have a label after SUB/FUNCTIONs?
-
you have a sub in your first include file, right there is your error,
if you have a include file that is a sub place it at the bottom of the program.
'$include: 'lordwrite.bas' <----- guy right here is a SUB!!!
'$include: 'moblist.bi'
'$include: 'equipment.bi'
just as Fellippe has been saying.
Kinda neat that you want to remake LORD though, i've thought about it a few times.. I love remaking or cloning old games.
can't wait to see how this turns out.
-
you have a sub in your first include file, right there is your error,
if you have a include file that is a sub place it at the bottom of the program.
'$include: 'lordwrite.bas' <----- guy right here is a SUB!!!
'$include: 'moblist.bi'
'$include: 'equipment.bi'
just as Fellippe has been saying.
Kinda neat that you want to remake LORD though, i've thought about it a few times.. I love remaking or cloning old games.
can't wait to see how this turns out.
omg am i dumb.. lemme check that out...
search source forge. i have several on there in php, there is one that is almost complete, i think it is on riouxsvn.com but not sure if i have it public.
-
Cobalt beat me to it.
@Fell, I always make it a rule to place data statements with labels at the end of main, before the first sub/function. I think that's a good programming practice. Nice to see that's already in the WIKI. Now I'm wondering if it was made that way by Rob to be QBasic compatible? I don't have access to my old computer with QB on it now, so I can't check. It seems if it was not to maintain compatibility, it might be a good idea to disallow non-label data placed after sub/functions, too.
@xra7en No worries, it happens to all of us from time to time... To many trees to see the forest.
Pete
-
you have a sub in your first include file, right there is your error,
if you have a include file that is a sub place it at the bottom of the program.
'$include: 'lordwrite.bas' <----- guy right here is a SUB!!!
'$include: 'moblist.bi'
'$include: 'equipment.bi'
just as Fellippe has been saying.
Kinda neat that you want to remake LORD though, i've thought about it a few times.. I love remaking or cloning old games.
can't wait to see how this turns out.
THHAAAAAAAAAAT was it. "gawd" /facepalm
maybe i should turn my flowchart rightside up :P
Thanks = works!, now I am back to my original bug hahaha - but thats normal. programming is not fun w/o bugs