Monk or ted don't seem to be importing mojo
Monkey Forums/Monkey Programming/Monk or ted don't seem to be importing mojo
| ||
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. |
| ||
which version of monkey are you using? have you updated to the latest version? |
| ||
it is version 60 from about a month ago |
| ||
Can you redownload Monkey and put it in another location (eg MonkeyPro60) and try again from fresh? |
| ||
I will give that a try |
| ||
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? |
| ||
do any of the demos that come with monkey work? |
| ||
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... |
| ||
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? |
| ||
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. |
| ||
|
| ||
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). |
| ||
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 |
| ||
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) |
| ||
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. :) |
| ||
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.... |