Labels inside functions not found when compiling

BlitzMax Forums/BlitzMax Beginners Area/Labels inside functions not found when compiling

Marco A G Pinto(Posted 2012) [#1]
Hello!

I am converting my utility to BlitzMax but I am facing some difficulties.

When I have labels inside of functions they aren't found when compiling.

Let me give you an example:
(WORKS)



(DOESN'T WORK)



I am using BlitzMax V1.45 for Windows.

Kind regards,
>Marco A.G.Pinto
--------------------

Edit: just to fix the word "End Function" since a few letters were missing from the copy/paste from the IDE.

Last edited 2012


BlitzSupport(Posted 2012) [#2]
Hi Marco,

You need to put the data outside the function:

'PLEASE NOTICED THAT I ONLY PLACED HERE A FEW DEFDATA

	'Get ROM values For 48 kB Spectrum
	Global rom_value48[256]
	get_rom_values_48k()

	WaitKey
	End

'This function gets the ROM values for the 48 kB ROM in order
'to point the lives counter To a ROM address
Function get_rom_values_48k()
	Local a:Long, b:Long
	RestoreData rom48
	For f=0 To 255
		ReadData a,b
		rom_value48[a]=b
	Next
	Return
End Function

#rom48
	DefData 0,30
	DefData 1,110
	DefData 2,76
	DefData 3,68
	DefData 4,611
	DefData 5,612
	DefData 6,610
	DefData 7,609
	DefData 8,613


Also, you can't use 'Next f' in BlitzMax; just use 'Next'.

[EDIT: I've moved this thread out of the Bug Reports forum.]

Last edited 2012