Cannot find function

BlitzMax Forums/BlitzMax Programming/Cannot find function

Raz(Posted 2012) [#1]
I know I am doing something stupid here but... in the following scenario I get the an "Compile Error: Identifier 'DifferenceIsLess' not found" error from within the camera.bmx file.

main.bmx
Strict
Include "src/functions.bmx"
Include "src/camera.bmx"


src/functions.bmx
Function DifferenceIsLess(A:Float,B:Float,DifCheck:Float)

EndFunction


src/camera.bmx
Type Camera

  Function Update()
    If DifferenceIsLess(10,20,5)
      ' DO STUFF
    EndIf
  EndFunction

EndType


What am I doing wrong?

Last edited 2012


GfK(Posted 2012) [#2]
You have a colon in your function definition which should be a comma ( after B:Float).


Raz(Posted 2012) [#3]
Oops, typo above fixed, the actual code doesn't have this mistake.


Raz(Posted 2012) [#4]
Also for what it's worth, I've got the clamp function in functions.bmx too, and I get the same error when that's called

Function Clamp:Float(val:Float, minimum:Float = 0.0, maximum:Float = 1.0)
	
	Return Min (Max (val,minimum),maximum)

EndFunction



GfK(Posted 2012) [#5]
Ah, didn't think that'd even compile error-free!

From experience, and i'm guessing theres a lot more code you haven't posted, i'd be looking for mismatched code blocks (if/endif etc) as that will often throw up an error elsewhere which is nothing to do with the actual problem.


Raz(Posted 2012) [#6]
Damnit yeah there was other code, I had an Import elsewhere, instead of an Include :B

Thanks anyway GfK.

Very glad to see I've pretty much forgotten all of the BlitzMax stuff I once knew.


Raz(Posted 2012) [#7]
Hahaha oh dear... and I didn't realise (forgot?) that blIDE automatically includes files added to the project... I'm on a roll