Simple programme fail - following tutorial.

Monkey Forums/Monkey Beginners/Simple programme fail - following tutorial.

Matt Finch(Posted 2014) [#1]
Hi all,

Just started to follow some excellent video tutorials (as suggested in this very forum) but even though I have copied things word for word, I am getting the following error:

mingw32-make: *** [../main.o] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS="-Wno-free-nonheap-object -O3 -DNDEBUG" OUT="Release/MonkeyGame"', return code=2

My code (slightly different from the tutorial as I was trying various things out, but this should work):

Function Multi:Int(value1:Int, value2:Int)
Return value1 + value2

Function Main:Int()
Local words:String = "The answer is: "
Local tot:Int = Multi(5, 5)
Print(words + tot)
Return 0

However, if I remove the 'Multi' function and do the calculation within 'Main', all works fine.

I am using Desktop as the target and have not adjusted any other settings since install. My apologies if I'm missing something (most likely!) obvious.


ziggy(Posted 2014) [#2]
Your code works great here. Which Monkey version are you using? Maybe you're using a wrong MinGW compiler? Does it works well when targeting html5?

Matt Finch(Posted 2014) [#3]
Hi Ziggy, thanks - it 'appears' to compile when using HTML5, although I get a blank browser window, so the expected result is not displayed. Could well be MinGW related, but I struggled to work out exactly what I needed to do to verify that. Thanks again, Matt...

Matt Finch(Posted 2014) [#4]
Update: I installed the latest MinGW update and everything seems to work fine now - thanks again for your suggestion. :)

ziggy(Posted 2014) [#5]
You're welcome!