HostOS() Problems
Monkey Forums/Monkey Beginners/HostOS() Problems
| ||
Why does the following short program not work? Import mojo Import os Class myGame Extends App Field operatingSystem:String = "setup" Method OnCreate() operatingSystem = String(HostOS()) End Method OnUpdate() End Method OnRender() DrawText(operatingSystem,100,100) End Method OnLoading() End Method OnSuspend() End Method OnResume() End End Function Main() New myGame() End On the Desktop Game target I get the following error: 'make' is not recognized as an internal or external command, operable program or batch file. TRANS FAILED: Error executing 'make CCOPTS="-Wno-free-nonheap-object -O3 -DNDEBUG" OUT="Release/MonkeyGame"', return code=1 On the Android target I get the following error: BUILD FAILED D:\Android\tools\ant\build.xml:712: The following error occurred while executing this line: D:\Android\tools\ant\build.xml:726: Compile failed; see the compiler error output for details. On the html5 target it just prints "setup." I am using Monkey 77d. Jason |
| ||
here is the list of how to get the different targets set up: http://monkeycoder.co.nz/docs/html/Target%20SDKs.html make sure you have mingw32 and the android setup correctly. also make sure the Monkey/bin/config.winnt.txt has the correct paths. |
| ||
I have set up Android (already created some test .apk files with it in Monkey as well as other game engines) but I still get the same errors for android. Will double check the other targets now. Jason |
| ||
To text Android I used the simple program shown below:Import mojo Import os Class myGame Extends App Field operatingSystem:String = "setup" Method OnCreate() End Method OnUpdate() End Method OnRender() DrawText(operatingSystem,100,100) End Method OnLoading() End Method OnSuspend() End Method OnResume() End End Function Main() New myGame() End It worked perfectly (including creating an .apk file which works). Then I added one line (operatingSystem = String(HostOS())) to make the code the following: Import mojo Import os Class myGame Extends App Field operatingSystem:String = "setup" Method OnCreate() operatingSystem = String(HostOS()) End Method OnUpdate() End Method OnRender() DrawText(operatingSystem,100,100) End Method OnLoading() End Method OnSuspend() End Method OnResume() End End Function Main() New myGame() End And it does not work. I still get the following error message: BUILD FAILED D:\Android\tools\ant\build.xml:712: The following error occurred while executing this line: D:\Android\tools\ant\build.xml:726: Compile failed; see the compiler error output for details. Jason |
| ||
it's a bug! HostOS() is not valid for anything other than desktop targets, and it looks like the compiler gate for that is not implemented. you could use this instead: #if TARGET="android" operatingSystem = "android" #elseif TARGET="glfw" operatingSystem = String(HostOS()) #endif |