Monk or ted don't seem to be importing mojo

Monkey Forums/Monkey Programming/Monk or ted don't seem to be importing mojo

gstrekkie(Posted 2012) [#1]
i'm not sure why this started happening but I keep getting the error "Type 'App' not found" when building/running any project that imports mojo. the console output at the bottom of ted reads below.

"/Applications/MonkeyPro/bin/trans_macos" -target=html5 -config=Debug -run "/Volumes/Data/Monkey Projects/Billiards/Billiards.monkey"
TRANS monkey compiler V1.36
Parsing...
Semanting...
/Volumes/Data/Monkey Projects/Billiards/Billiards.monkey<8> : Error : Type 'App' not found
Done.

the error is occurring at


Import mojo

Global Circles:List <circle>

Class Pool Extends App <<<<<<<<<<<<<compile stops here.



i have verified that mojo exists in the modules Directory and I have even recopied the folder as well. additionally I checked to see if ted is pointing to the monkey directory and it is. I'm currently running on a Mac pro with 10.7.4 any thoughts on this would be appreciated.


Jesse(Posted 2012) [#2]
which version of monkey are you using?
have you updated to the latest version?


gstrekkie(Posted 2012) [#3]
it is version 60 from about a month ago


therevills(Posted 2012) [#4]
Can you redownload Monkey and put it in another location (eg MonkeyPro60) and try again from fresh?


gstrekkie(Posted 2012) [#5]
I will give that a try


gstrekkie(Posted 2012) [#6]
Still not working.. is it possible that updating to 10.7.4 caused something to break?
is it advisable to edit some config files or something?


Jesse(Posted 2012) [#7]
do any of the demos that come with monkey work?


gstrekkie(Posted 2012) [#8]
sorry for delay was traveling a few days. anyway the demos do indeed work and I tried to copy them to the same directory I have the other projects in and the demos still work. Curiouser and Curiouser...


therevills(Posted 2012) [#9]
Can you create a small mojo example?

For example:
[monkeycode]Strict

Import mojo

Function Main:Int()
New MojoApp()
Return 0
End

Class MojoApp Extends App
Method OnCreate:Int()
SetUpdateRate(30)
Return 0
End

Method OnUpdate:Int()
Return 0
End

Method OnRender:Int()
DrawText("Hello Mojo", 10, 10)
Return 0
End
End[/monkeycode]
Does this work?


gstrekkie(Posted 2012) [#10]
that particular example worked and oddly enough I tried placing the strict directive at the beginning and this caused the error to change as a result I removed the strict directive and Viola ! it compiled and ran. not sure why this would occur but i will include the source I was using below.


gstrekkie(Posted 2012) [#11]



therevills(Posted 2012) [#12]
I tried placing the strict directive at the beginning and this caused the error to change as a result I removed the strict directive and Viola

Are you saying your code now compiles okay?

BTW edit you previous post and wrap your code in [ codebox ] [ /codebox ] tags (without the spaces).


BlackD(Posted 2012) [#13]
The reason it doesn't work when Strict is on is because you're not declaring the types for your methods/functions.

eg:
Method OnCreate:Int()
Function RenderCircles:Void()

For each function, you need to determine its type based on what it returns.
:int (function returns integer)
:float (function returns float)
:void (function returns nothing)
:bool (function returns TRUE or FALSE)

An exception is your main() function, which MUST be an INT. Actually, all the built-in methods must be int. OnUpdate(), OnCreate(), OnRender() and any others that escape my attention.

Your variables are also missing :int :float, etc, although some have # which substitutes for :float. Example:
Local ballTriangleSize:int = 5
For Local xloop:int = ballTriangleSize To 1 Step - 1
For Local yloop:int = 1 To xloop

Finally, your code fixed, with Strict enabled.



It's a good idea to keep Strict on whenever possible. :)

+BlackD


therevills(Posted 2012) [#14]
OT: Welcome BlackD to Monkey... I'm guessing you are BlackD from TOG, as Samah recalls talking to you about BlitzMax :) (I'm DangerMouse on TOG)


BlackD(Posted 2012) [#15]
Thanks! Haha, yeah - one and the same. :) Finally trying to get my Monkey on to start making my mark on the mobile world. ^^ Or at the very least, to get some Flash games up on my currently empty website. :)


gstrekkie(Posted 2012) [#16]
Sorry I didnt use the [ codebox ] in the body that I posted. I was windering how everyone was doing that and I thank everyone for their valuable insights I'm not sure why the code began working seemingly in a spontaneous manner other than the obvious error I got when merely adding strict to the top the code remained unchanged and began working the way it should once I removed the offending "Strict" mode. so all is well in the monkey universe now. Now I can get back to learning....