freebasic compiling problems

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

Post Reply
Andi
Coder
Posts: 10
Joined: Tue Aug 15, 2006 10:11 pm
Location: Chicago, IL
Contact:

freebasic compiling problems

Post by Andi » Mon Oct 23, 2006 6:17 pm

I'm using FreeBasic Compiler to compile a Qbasic program I wrote. Unfortunately, I keep getting errors that say:
C:\qbfiles\fbasic>fbc example/uncle.bas
example/uncle.bas(1543) : warning level 0: Implicit variable allocation, rathole3num
example/uncle.bas(2420) : warning level 0: Implicit variable allocation, pianonum
example/uncle.bas(3046) : warning level 0: Implicit variable allocation, paintingnum
example/uncle.bas(290) : error 95: Branching to other SUB's/FUNCTION's or to mod
ule-level, to label: ROOM1
example/uncle.bas() : error 48: Undefined label, ROOM1
example/uncle.bas() : error 48: Undefined label, STORY
example/uncle.bas() : error 48: Undefined label, HELP
example/uncle.bas() : error 48: Undefined label, ABOUT
example/uncle.bas() : error 48: Undefined label, LOG1
example/uncle.bas() : error 48: Undefined label, LOG2
example/uncle.bas() : error 48: Undefined label, LOG3
example/uncle.bas() : error 48: Undefined label, VINE1
example/uncle.bas() : error 48: Undefined label, VINE2
example/uncle.bas() : error 120: Too many errors, exiting
Here is the beginning of my code. This code works fine when running inside of Qbasic itself. I edited out the sub declarations at the beginning.

Code: Select all

start: CLS
treasurenum = 0
revolvernum = 0
armsnum = 0
bulletnum = 0
vinenum = 0
hammernum = 0
key1num = 0
lanternnum = 0
shovelnum = 0
ballnum = 0
key2num = 0
key3num = 0
laddernum = 0
acidnum = 0
apekillnum = 0
new = 1
log1num = 0
log3num = 0
vine2num = 0
gravenum = 0
pitnum1 = 0
pitnum2 = 0
moundnum = 0
arm2num = 0
arm3num = 0
arm4num = 0
grassnum = 0
pantherkillnum = 0
dogkillnum = 0
benchnum = 0
tdoor1num = 0
tdoor2num = 0
bucketnum = 0
hole1num = 0
bricknum = 0
cranknum = 0
dropnum = 0
mutantkillnum = 0
rathole1num = 0
rathole2num = 0
rathol3num = 0
door14num = 0
pouchnum = 0
chestnum = 0
ballcount = 0
rashnum = 0
rashcount = 0
orchidcount = 0
skeletonnum = 0
engravenum = 0
catnum = 0
eelnum = 0
clocknum = 0
engravecount = 0
tdoor2num = 0
dogrunnum = 0
spicenum = 0
spicekillnum = 0
bagnum = 0
woodchestnum = 0
biscuitnum = 0
mechmannum = 0
maneatnum = 0
vaultnum = 0
ballgrabnum = 0
winnum = 0
bednum = 0
pillownum = 0
levernum = 0
safenum = 0
flowernum = 0
flashnum = 0
kawandusnum = 0
hogkillnum = 0
hammerdoor = 0
COLOR 8
PRINT "                                 Uncle Andrew's Manor"
PRINT ""
COLOR 3
PRINT "                                 A game by Andi Hagen"
PRINT ""
COLOR 6
PRINT "(a) begin"
PRINT "(b) story"
PRINT "(c) instructions"
PRINT "(d) about"
PRINT "(e) quit"
PRINT ""
COLOR 7
PRINT "What is your choice"; : INPUT choice$
IF choice$ = "a" THEN GOTO room1
IF choice$ = "b" THEN GOTO story
IF choice$ = "c" THEN GOTO help
IF choice$ = "d" THEN GOTO about
IF choice$ = "e" THEN GOTO quit
GOTO start

story:
CALL story
GOTO start

help:
CALL help
GOTO start
quit: END

about:
CALL about
GOTO start

''''''''''''''''''''''''''''''''''''''''''''''
room1:
IF ballnum = 1 THEN ballcount = ballcount + 1
IF ballcount = 10 THEN
 CALL ballboom
 GOTO start
END IF
Does anyone know what those error codes are caused by? Do I have to define my line labels differently or something? And what does "implict variable allocation" mean?

Thanks a lot.
Image

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm » Tue Oct 24, 2006 4:01 am

Hard to say anything when seeing only that piece of code.
implict variable allocation means you have a bug in your source...lol ok. You have problem with variables. Cant point it directly anywhere since cant see your source.

RayBritton
Veteran
Posts: 109
Joined: Thu Feb 10, 2005 12:38 pm

Post by RayBritton » Tue Oct 24, 2006 6:02 am

generally implict variable allocation means that you haven't dimed you varibles, but for the undefined labels, i would have to see the whole code

Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Post by Antoni » Tue Oct 24, 2006 2:42 pm

You are using the 0.17 unstable version, right?
0.17 has engaged in a new way and it has become very picky about DIMming variables, I can't tell you about labels as i never use them. To recover the QB-friendly behavior add to the command line the new option -lang qb

Code: Select all

fbc -lang qb  mysource.bas
This will allow you to code in a more QB'ish manner, but will keep you from using the more advanced features of the language. see
http://www.freebasic.net/wiki/wikka.php ... erDialects
for more information.

Andi
Coder
Posts: 10
Joined: Tue Aug 15, 2006 10:11 pm
Location: Chicago, IL
Contact:

Post by Andi » Tue Oct 31, 2006 11:42 pm

Antoni wrote:You are using the 0.17 unstable version, right?
0.17 has engaged in a new way and it has become very picky about DIMming variables, I can't tell you about labels as i never use them. To recover the QB-friendly behavior add to the command line the new option -lang qb

Code: Select all

fbc -lang qb  mysource.bas
I tried using -lang qb with the FreeBasic Compiler and I continually get a command line error that says that it doesn't understand the command. I am indeed running 0.17. Ugh...

Here is my complete code for anyone interested in taking a crack at it:

http://spacebabes.org/uncle.bas

There is another version of the codewhere I tried dimming all the variables at the very beginning, but that didn't seem to do anything. I'm not quite sure I even understand what dimming does though.
Image

RayBritton
Veteran
Posts: 109
Joined: Thu Feb 10, 2005 12:38 pm

Post by RayBritton » Wed Nov 01, 2006 5:05 am

Well I had a look and removed a few of the errors, try going to www.freebasic.net/forum to get help with fb

http://fileanchor.com/75857-d

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm » Wed Nov 01, 2006 5:05 am

I dont get why it gives those errors. All labels does exist but still it keeps whining about them.
If any one in here cant help, then i recommend you to ask at www.freebasic.net forums. Alltho, buddies at here are clever enough prolly to figure out why it's not working.

There is alltho tens of places where you could do things more easily but if youre interested to know, ask when you got this version working fine.
Hopefully you got it soon.

User avatar
Skyler
Coder
Posts: 16
Joined: Wed Jun 07, 2006 4:15 pm
Location: Delta Quadrant

Post by Skyler » Thu Nov 30, 2006 9:17 am

1. Compile it in QBASIC.
2. Get a different version of FB.
For God so loved the world he gave His only begotten Son that whosoever believeth on Him shall have everlasting life.
John 3:16

Post Reply