Author Topic: For the Pro's! All DATA RESTORE not working anymore  (Read 4525 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
For the Pro's! All DATA RESTORE not working anymore
« on: December 06, 2018, 01:26:27 am »
Code: QB64: [Select]
  1. COOLLABEL:
  2. DATA BLA,BLA,BLA,
  3.  
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

Quote
c++ compilation failed check .\internal\temp\compilelog.txt

which I do and I get:
Quote
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

« Last Edit: December 06, 2018, 10:14:47 am by xra7en »
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #1 on: December 06, 2018, 02:11:21 am »
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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #2 on: December 06, 2018, 05:30:42 am »
Is your data block after a sub or function?

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #3 on: December 06, 2018, 05:46:39 am »
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

Code: QB64: [Select]
  1. PRINT "123"
  2. CALL subx
  3.  
  4. SUB subx
  5. READ a$
  6.  
  7. DATA abc

Whereas this code, with a data label, gives the exact same error message the OP reported...

Code: QB64: [Select]
  1. PRINT "123"
  2. CALL subx
  3.  
  4. SUB subx
  5. READ a$
  6.  
  7. mydata:
  8. DATA abc

I recall in QBasic, you couldn't even put data statements in subs.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #4 on: December 06, 2018, 08:32:32 am »
It’s even in the wiki:

Quote
DATA fields can be placed after SUB or FUNCTION procedures, but line labels are not allowed.

http://www.qb64.org/wiki/DATA

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #5 on: December 06, 2018, 09:09:52 am »
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.

I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #6 on: December 06, 2018, 09:10:44 am »
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 just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #7 on: December 06, 2018, 09:12:26 am »
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

Code: QB64: [Select]
  1. PRINT "123"
  2. CALL subx
  3.  
  4. SUB subx
  5. READ a$
  6.  
  7. DATA abc

Whereas this code, with a data label, gives the exact same error message the OP reported...

Code: QB64: [Select]
  1. PRINT "123"
  2. CALL subx
  3.  
  4. SUB subx
  5. READ a$
  6.  
  7. mydata:
  8. DATA abc

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.
« Last Edit: December 06, 2018, 10:12:00 am by xra7en »
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #8 on: December 06, 2018, 09:35:41 am »
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?
« Last Edit: December 06, 2018, 09:39:48 am by xra7en »
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #9 on: December 06, 2018, 09:39:01 am »
OK
just for grins I posted this data gem EVERYWHERE and it worked just fine.
Code: QB64: [Select]
  1.  
  2. RESTORE numbers
  3.  
  4. READ a, b, c
  5.  
  6. PRINT a, b, c
  7.  
  8.  
  9. numbers:
  10. DATA 1,2,3
  11.  

Soooooooo, that is why I am trying to narrow down - what exactly does that error me in the complier
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #10 on: December 06, 2018, 09:51:34 am »
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)
Quote
http://cgstation.linkpc.net/projects
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #11 on: December 06, 2018, 10:18:58 am »
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
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

FellippeHeitor

  • Guest
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #12 on: December 06, 2018, 11:11:37 am »
Are you sure you don't have a label after SUB/FUNCTIONs?

Marked as best answer by xra7en on December 06, 2018, 10:05:03 am

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #13 on: December 06, 2018, 11:40:14 am »
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.
« Last Edit: December 06, 2018, 11:41:57 am by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: For the Pro's! All DATA RESTORE not working anymore
« Reply #14 on: December 06, 2018, 11:44:54 am »
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.
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!