Part 1 – Get The Basics Going
I’ve just got a shiny new computer at home – nothing installed. So it seems like a good chance to go through exactly what it takes to get and NME sample up and running on a new Windows 7 box.
8:20pm For starters, I’ll need a c++ compiler, so first thing is to start the MSVC 2010 Express downloading: 2010-Visual-CPP.
8:25pm OK – I’ve signed my rights away and that is downloading. The next thing I’ll need is haxe. It is easy to install from here.
8:28pm Haxe 2.07, neko 1.81 downloaded and installed. Windows complained that it might not have installed correctly, but this is just because the exe had “installer” in the name, and did not write an “uninstall” entry.
Test: Start a “cmd” prompt by clicking on the Windows start circle and type “cmd[Enter]” into the search box. And in this box, type “haxe [Enter]”. I am now rewarded with the haxe help message.
8:35pm Visual C++ Express in successfully installed.
Test: Start up a new cmd shell, and type “cl“. This does not work because the exe can’t be found in my path. But here is the trick. Type “c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat” at the prompt (note:include the quotes!), and get the message “Setting environment for using Microsoft Visual Studio 2010 x86 tools.”. Now “cl” is rewarded with the Microsoft banner.
8:41pm I’m on a bit of a roll here, so I’ll see if I can get an haxe project going. As I said, I have nothing installed, so I’ll go old-school. First thing is to make a directory. The cmd prompt starts in my home directory (c:\Users\Hugh), and I will make a directory:
mkdir projects
cd projects
mkdir hello
cd hello
And now, do the best I can:
notepad.exe Hello.hx (yes I do want to create the file)
class Hello { public static function main() { trace("Hello!"); } }
And switch back to the cmd prompt:
haxe -main Hello -neko hello.n
neko hello.n
Hello.hx:5: Hello!
Woo Hoo! 8:48pm and I’ve run my own program.
Now lets get even more adventurous, and try a c++ example. Trying:
haxe -main Hello -cpp bin
Tells me that “Project hxcpp is not installed” – so let’s install it:
haxelib install hxcpp
And try again:
haxe -main Hello -cpp bin
And test:
bin\Hello.exe
8:43pm, I have my first hxcpp prgram working!
Now, try for some graphics:
haxelib intall nme
and start a new project:
cd ..
mkdir graphics1
cd graphics1
copy “c:\Motion-Twin\haxe\lib\nme\2,0,1\samples\02-Text\Sample.hx”
haxe -main Sample -cpp bin -lib nme
bin\Sample.exe
9:05pm And there it is. Haxe, neko, hxcpp, nme VC2010 installed and run in 40 minutes, including this write up.
Part 2 – Compile NME From Source
Well, that went much better than I expected, so I will now attempt some bleeding-edge stuff. The version on NME used above is old, and I have no one to blame but myself. My intentions are to do a release soon, but I just have not got my finger out. Which leave me with the option of compiling NME from source if I want the latest features.
First thing, is to create a place where I can download various bits of source code for compiling. I’m going to put it a “e:\code.google”, because my C drive is a fast SSD, and has limited room.
e:
mkdir code.google
cd code.google
Following the instructions from the source page, but changing the name, I can get a copy with:
svn checkout http://nekonme.googlecode.com/svn/trunk/ nme
– if only I had svn installed. So first install this, I’ll be using this version. Once installed, I have to restart the cmd prompt and do the vsvars32.bat thing again. Now when I try again, I get the required files. There is also a companion project to go with NME, and that is the “sdl-static” project, which contains libraries required by NME. To get this, simply do:
svn checkout http://sdl-static.googlecode.com/svn/trunk/ sdl-static
This takes a while….
Time to build –
cd nme\project
haxelib run hxcpp Build.xml
The “haxelib” tool looks for a file called “run.n” in an installed haxe library and runs it. In the hxcpp project, the run.n file gathers compiler options to build the haxe output. This same program can be used to build other projects – including the NME project. Unfortunately, compiling NME like this gives the error ” cannot open input file ‘ddraw.lib'”. This is because the VC express install does not have all the required system support files. This file can be found in the “DirectX SDK”, and I’ll be using the June 2010 version. This is a huge file, so it will take a while. If you think it is a lot of effort for a tiny lib, then you are right.
10:10pm and the download has finished. I have chosen to install it in “e:\SDKs\Microsoft DirectX SDK (June 2010)”, because I’m trying not to put crap on my C drive, and I will be installing quite a few SDKs, and it is nice to have them all together.
This does not immediately fix the problem, because the NME project does not know where I installed it. This is where the per-machine hxcpp config comes in.
Following the instructions in BuildCommon.xml, I create a file in “C:\Users\Hugh” called “.hxcpp_config.xml”, and put the following in it:
<xml> <section id="exes"> <linker id="dll" if="windows"> <flag value = "-libpath:e:\SDKs\Microsoft DirectX SDK (June 2010)\Lib\x86"/> </linker> </section> </xml>
Oh crikey! Looks like Microsoft in their wisdom have dropped support for this ddraw.lib, and I’m currently using a version of SDL that needs it! It’s OK, problem solved – I’ve added it to the NME project, but you still need the SDK for dxguid.lib, which I guess I should also add.
Anyhow, after a long delay, at 10:30pm I have NME building!
Now, going back to the original graphics1 example, the first thing to do is tell haxe to use our SVN haxe code instead of the 2.0.1 dowloaded from haxelib. This is done via:
haxelib dev nme e:/code.google/nme
Then build & test:
haxe -main Sample -cpp bin -lib nme
bin\Sample.exe
Which works as before. But now we can test some of the new features in NME. First get the new sample, and the new associated project file:
copy e:\code.google\nme\samples\02-Text\Sample.hx .
copy e:\code.google\nme\samples\02-Text\Sample.nmml .
Then you can use the NME build tool, with the command “test” (which is “build” and “run”) on the Sample.nmml project file, and for the target “neko”.
haxelib run nme test Sample.nmml neko
And you can see the result. Then you can test for cpp:
haxelib run nme test Sample.nmml cpp
So it’s now 10:45pm (had to catch the end of “Dexter”) and I’ve successfully compiled the latest version of NME and tested the new project feature.
Part 3 – Android
Things seem to still be going well, so I’m going to take one more step – android (spoiler – this is going to take longer than expected). First thing to so is install the Java Development Kit. (NOTE: Install the “windows” version, not the “x64” version) Then, the android SDK.
I installed java JRE and JDK in my SDK directory, but Google’s (always painful) build tools seem to think I have not installed java, even though it works from the cmd prompt. Thank guys. So I’ve uninstalled it, and reinstalled the JRE in the default location, and now it seems happy. The Android SDK download is just the start – it now runs and downloads a whole bunch more. This looks like it may take some time…
I may as well get on with downloading the NDK too. And while I wait for those I’ll get my phone ADB USB drivers installed. My HTC phone actually installs the drivers when I install HTCSync, found on my sdcard that was shipped with it.
EDIT: The android ndk r5b still has issues with exceptions/c++. However, these can be solved by dropping this version of libstdc++.a from the Crystax r4 distribution over the top of sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a in your downloaded ndk. If google ever manage to write a good build system, they might end up being a successful company.
The Google build tools also require the “Cygwin” utilities, so install these too.
Finally, we will need a new version of hxcpp, which we can get with:
e:
svn checkout http://hxcpp.googlecode.com/svn/trunk/ hxcpp
haxelib dev hxcpp e:\code.google\hxcpp
11:45pm, I have finally downloaded and installed the Android prerequisites (I think) but will give up now.
Next day – Here we go again. Now to use the google android NDK, you need to have the cygwin dlls in your exe path. To change the path, right click in the “Computer” shortcut in the start menu, and choose “properties”, then on the left “Advance system settings”, then the “Environment Variables” button and scroll through the top bit for “PATH” and click “edit”. This already has haxe and neko in it, so we add the cygwin:
%HAXEPATH%;%NEKO_INSTPATH%;e:\SDKs\cygwin\bin
Now restart the cmd prompt, and typing “ls” should work.
And one more thing – in lieu of using “eclipse” for java building (which I just can’t stand – don’t get me started), the google tools need the “ant” program, which you install by unzipping somewhere.
Tell the build system where we installed these things.
set ANT_HOME=e:/SDKs/ant
set ANDROID_SDK=e:\SDKs\android-sdk
set ANDROID_NDK_ROOT=e:\SDKs\android-ndk
set JAVA_HOME=e:\SDKs\Java\jdk1.6.0_24
And rebuild nme, like before, except that the “obj” directory should be removed first, because I have not yet allowed 2 compilers to be running at the same time.
haxelib run hxcpp Build.xml -Dandroid
Now, back in the original directory, we can build + run for android:
haxelib run nme test Sample.nmml android
Which, finally, works! You can terminate the debug log with control-c.
So, an awful lot of set up, but subsequent projects should only be a single line.
thanks for sharing.
i have encountered a problem that the NME samples couldn’t run on Android 2.1 device, but everything is OK on Android 2.2
anything advice?
Hi,
I recently upgraded my phone to 2.2, so I didn’t notice. But just last night I saw a warning that the libstdc++ version I am using is not compatible with 2.1. The google STL system is a mess – I’m not happy with the warnings generated by the current system, so I will have to have another go. It is really a matter of getting the include paths and lib paths correct (as it is with any compiler). I don’t know why google has to make is so hard to get this right.
thanks for replay and i have saw the google warning too, i try to compile NME with NDK-r4-Crystax and it works on Android 2.1
I replaced the latest HXCPP build tool (version 2.07.0) with older one (version 2.06.0), just overwrite the “build-tool” folder while the older build tool uses NDK r4.
What annoyed me is that the r4 compile result file is much bigger than the file generated by r5
Hi Jason,
The new build tool does a “strip” after it has compiled. This removes debug and junk. This could be done with crystax r4 easily enough.
Hi Jason,
That warning is actually coming from my code – I put it in there to remind me to tell everyone they need a modified version of libstdc++ (from the crystax build). I have now modified the build instructions to describe this. You will also need a new HXCPP.
Hi Huge,
Thanks a lot for your brilliant work
I’ve tried with the newest hxcpp form SVN.
It can’t finish the link after compile with the libstdc++.a file you offered, Inspired by the idea I copied a libstdc++.a from /build/prebuilt/darwin-x86/arm-eabi-4.4.0/arm-eabi/lib/libstdc++.a to NDK r5b, it works fine both on Android 2.1 & 2.2
I wonder if you have uploaded the wrong file:)
Hi
You are right. The supplied lib worked on windows, but not mac. So now I’ve updated to the mac one on the site, and it works on windows, so it seems good.
I just can’t work out why there should a difference between the mac and windows version. One day Google might make a logical build system, but we shall have to wait.
Thanks a lot for writing this. Being new to android and nme development, I followed this guide and got my first android app running on my phone. 😀
One hiccup I found was that if the android sdk or ant are in a directory with spaces, e.g., “C:Program Files (x86)apache-ant”, then the build scripts don’t work (tried both with and without quotes in the environment variables.) I had to move them to a space-less directory in order to get it working. But got there in the end.
One thing I have initially noticed, and something I will be chasing up, is that the NME Sample 02 example installed on my phone comes to 6.88Mb — which seems quite a lot. In comparison Fruit Ninja is 1.39Mb.
Anyways, keep up the good work!
re: file size. I will have to look into it. I have added some “strip” code, which I hope will help. Otherwise I may need some tools to find where the mem is going.
hi
i get error
ubuntu 64
~/code.google/sdl-static/src$ make curl
if2ip.c:47:26: fatal error: sys/sockio.h: no file
how do ??
in ubuntu 11
64
it was not work
I have made a change to the linux/libcurl some of this a few days ago – hope it fixes it.
Hi
Hmm tried to get it working on a few Android 2.1 devices, and a 2.2 emulator but keep getting a segfault. Used all the newest stuff from svn, should it still work?
Great job anyway, this would be awesome if I could get it to work 😉
Hi Francois,
Did you drop in the updated version of libstdc++ on top of r5, mentioned in the “Edit” section?
Hi Huge. I’m following the steps above, trying to get up and running on Android. Everything seems to go well for me, but when I try to test the sample program (“haxelib run nme test Sample.nmml android”), I ge the following error:
Called from nme/Lib.hx line 104
Called from neko/Lib.hx line 33
Uncaught exception – load.c(232) : Failed to load library : nekoapi.ndll
Any ideas?
Thanks for your help.
–Nels
…Actually, after closer inspection I see that I get a similar error when executing the earlier command “haxelib run nme test Sample.nmml cpp” to test the Windows build… however, compiling the earlier example with “haxe -main Hello -cpp bin
” and running with “binsample.exe” worked just fine. So, seemingly something about use the .nmml build path is not working for me.
Again, any help appreciated.
–Nels
Hi! Nice article, but after compiling NME from latest revision Im getting an errors like that:
D:workhaXetestsgraphics1>haxelib run nme test Sample.nmml cpp
Called from nme/utils/NekoAPI.hx line 8
Called from neko/Lib.hx line 33
Uncaught exception - load.c(232) : Failed to load library : nekoapi.ndll
I am also getting the same error as Nels and would appreciate any feedback. In the same way, the earlier Hello cpp build worked without a problem.
Hi, the latest code should be smarter about how it finds nekoapi -is it working now?
The latest SVN revision (787, I believe) seems to get the sample code working for me. However, now my actual project, which builds and runs fine with nme revision 680 via FlashDevelop/Eclipse, generates the following debug output when I build and run:
(…)
07-21 11:11:32.550: DEBUG/dalvikvm(6547): Trying to load lib /data/data/com.parallax/lib/libnme.so 0x40867330
07-21 11:11:32.560: DEBUG/dalvikvm(6547): Added shared lib /data/data/com.parallax/lib/libnme.so 0x40867330
07-21 11:11:32.560: DEBUG/dalvikvm(6547): No JNI_OnLoad found in /data/data/com.parallax/lib/libnme.so 0x40867330, skipping init
07-21 11:11:32.560: DEBUG/dalvikvm(6547): Trying to load lib /data/data/com.parallax/lib/libstd.so 0x40867330
07-21 11:11:32.560: DEBUG/dalvikvm(6547): Added shared lib /data/data/com.parallax/lib/libstd.so 0x40867330
07-21 11:11:32.560: DEBUG/dalvikvm(6547): No JNI_OnLoad found in /data/data/com.parallax/lib/libstd.so 0x40867330, skipping init
07-21 11:11:32.560: DEBUG/dalvikvm(6547): Trying to load lib /data/data/com.parallax/lib/libMain.so 0x40867330
07-21 11:11:32.580: DEBUG/dalvikvm(6547): Added shared lib /data/data/com.parallax/lib/libMain.so 0x40867330
07-21 11:11:32.580: DEBUG/dalvikvm(6547): No JNI_OnLoad found in /data/data/com.parallax/lib/libMain.so 0x40867330, skipping init
07-21 11:11:32.580: INFO/haxe plugin(6547): Got Load Proc 0x815ec8dc
07-21 11:11:32.580: ERROR/loader(6547): Could not find primitive nme_byte_array_init__4 in 0xb000e3f8
07-21 11:11:32.580: INFO/haxe plugin(6547): Got Load Proc ���@-���
(…etc…)
Hi Nels,
It looks like something might be out-of-date, and you need a new NME binary for android. Do you compile this yourself, or use the one in SVN? The SVN one could be out of date until I submit anew build.
Almost the same issue here. Trying to complile/run haXeRush example from http://blog.krozalski.com/?p=91 after running compiled .apk on emulator or on my phone I am getting a black screen and there are two errors in logcat:
08-02 20:57:45.755: ERROR/loader(13809): Could not find primitive nme_byte_array_init__4 in 0x700100c4
08-02 20:57:45.765: ERROR/Exception(13809): Could not load module libzlib@deflate_init__1
I’ve updated nme and hxcpp to latest versions today and successfully compiled nme from sources with haxelib run hxcpp Build.xml but result is the same.(
Any suggestions?
ok, I solved first just by recompiling hxcpp/nme.
for second one I was to add zlib to my project. (by the way I am wondering, why I need it, I dont use zlib in my project)
hope this will help someone.
thanx again.
Could anyone spare 5 minutes to tell me how to start using the tools? I already have everything installed just need to make the connection to InstallTool etc. My Skype is Mihail121, thanks 🙂
I got the
haxe -main Hello -cpp bin
example working, but when I went to do the graphics example
haxe -main Sample -cpp bin -lib nme
I got the following error output (shown here with command prompts):
c:__projectshaxedev>cd graphics1
c:__projectshaxedevgraphics1>haxe -main Sample -cpp bin -lib nme
haxelib run hxcpp Build.xml haxe -Dcpp -Dhaxe_208 -Dnme -Dtrue
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
Creating hxcpp.pch...
cl.exe -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -IC:Motion-Twin
haxelibhxcpp2,06,1/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Ie:/VS8//Platf
ormSDK/Include -Ie:/VS8//PlatformSDK/Include -Ychxcpp.h __pch.cpp /Fphxcpp.pch
__pch.cpp
cl.exe -I. -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -IC:Motion-T
winhaxelibhxcpp2,06,1/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Ie:/VS8//P
latformSDK/Include -Ie:/VS8//PlatformSDK/Include -Yuhxcpp.h ./src/nme/Lib.cpp -F
oobj/Release/src/nme/Lib.obj
cl.exe -I. -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -IC:Motion-T
winhaxelibhxcpp2,06,1/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Ie:/VS8//P
latformSDK/Include -Ie:/VS8//PlatformSDK/Include -Yuhxcpp.h ./src/cpp/rtti/Field
NumericIntegerLookup.cpp -Foobj/Release/src/cpp/rtti/FieldNumericIntegerLookup.o
bj
Lib.cpp
FieldNumericIntegerLookup.cpp
c:__projectshaxedevgraphics1binincludecpp/rtti/FieldNumericIntegerLookup.h
(17) : error C4430: missing type specifier - int assumed. Note: C++ does not sup
port default-int
./src/cpp/rtti/FieldNumericIntegerLookup.cpp(10) : error C2039: '__mClass' : is
not a member of 'cpp::rtti::FieldNumericIntegerLookup_obj'
c:__projectshaxedevgraphics1binincludecpp/rtti/FieldNumericInteger
Lookup.h(13) : see declaration of 'cpp::rtti::FieldNumericIntegerLookup_obj'
./srcc:/c_p_ppr/orjtetcit/sFihealxdeNduemvergircaIpnhtiecgse1rLboinincloukd
uep.ncppm(e1/2d)i s:p learyr/oIrB iCt2m0a3p9D:r a'w_a_brleeg.ihs(t2e0r)' :: e
irs notr oar mCe4m4b3e0r: omfi s'scipnpg: :trytptei :s:pFeiceilfdiNeurm e-r ii
cnItn taesgseurmLeodo.k uNpo_toeb:j 'C
++ d oes not supp o r t cd:ef_a_uplrto-jienctt
shaxedevgraphics1binincludecpp/rtti/FieldNumericIntegerLookup.h(13) : see d
eclaration of 'cpp::rtti::FieldNumericIntegerLookup_obj'
./src/cpp/rtti/FieldNumericIntegerLookup.cpp(16) : error C2653: 'super' c:: i_s
_ pnrootj eac tcslahsasx eodre vnagmreaspphaicces 1nabmien
inc.l/usdrec/ncmpep//ervtetnit/sF/iIeElvdeNnutmDeirsipcaItnctheegre.rhL(o1o8k)
u p:. ceprpr(o1r6 )C 4:4 3e0r:r omri sCs3i8n6g1 :t y'p_e_ SsGpeetcCilfaier - int
s sa's:s uimdeendt.i fNioetre :n oCt+ +f oduoneds
not support default-int
Called from ? line 1
Called from BuildTool.hx line 1100
Called from BuildTool.hx line 501
Called from BuildTool.hx line 538
Called from BuildTool.hx line 657
Called from BuildTool.hx line 729
Uncaught exception - Error in building thread
./src/nme/Lib.cpp(133) : error C2039: 'LocalFunc' : is not a member of 'hx'
./src/nme/Lib.cpp(133) : error C2065: 'LocalFunc' : undecError : Build failed
lared identifier
./src/nme/Lib.cpp(133) : error C2065: '_Function_1_1' : undeclared identifier
./src/nme/Lib.cpp(133)
: ec:__projectshaxedevgraphics1>rror C2275: 'Dynamic' : illegal use of this
type as an expression
c:motion-twinhaxelibhxcpp2,06,1includeDynamic.h(10) : see declara
tion of 'Dynamic'
./src/nme/Lib.cpp(133) : error C2275: 'Array' : illegal use of this type
as an expression
with
[
ELEM_=int
]
./src/nme/Lib.cpp(133) : error C2275: 'Array' : illegal use of this type
as an expression
with
[
ELEM_=int
]
./src/nme/Lib.cpp(133) : error C2275: 'Array' : illegal use of this type
as an expression
with
[
ELEM_=int
]
./src/nme/Lib.cpp(133) : error C2275: 'Array' : illegal use of this type
as an expression
with
[
ELEM_=double
]
./src/nme/Lib.cpp(134) : error C2146: syntax error : missing ';' before identifi
er 'Void'
./src/nme/Lib.cpp(133) : error C3861: 'HX_BEGIN_LOCAL_FUNC_S5': identifier not f
ound
./src/nme/Lib.cpp(134) : error C2146: syntax error : missing ';' before identifi
er 'run'
./src/nme/Lib.cpp(134) : error C2275: 'Void' : illegal use of this type as an ex
pression
c:motion-twinhaxelibhxcpp2,06,1includenull.h(130) : see declarati
on of 'Void'
./src/nme/Lib.cpp(134) : error C2275: 'Dynamic' : illegal use of this type as an
expression
c:motion-twinhaxelibhxcpp2,06,1includeDynamic.h(10) : see declara
tion of 'Dynamic'
./src/nme/Lib.cpp(134) : error C2146: syntax error : missing ')' before identifi
er 'inFrameHandle'
./src/nme/Lib.cpp(134) : error C2059: syntax error : ')'
./src/nme/Lib.cpp(134) : error C2143: syntax error : missing ';' before '{'
./src/nme/Lib.cpp(137) : error C2065: 'inFrameHandle' : undeclared identifier
./src/nme/Lib.cpp(134) : error C3861: 'run': identifier not found
./src/nme/Lib.cpp(158) : error C2601: '__Run' : local function definitions are i
llegal
./src/nme/Lib.cpp(108): this line contains a '{' which has not yet been
matched
./src/nme/Lib.cpp(158) : error C2601: '__run' : local function definitions are i
llegal
./src/nme/Lib.cpp(108): this line contains a '{' which has not yet been
matched
./src/nme/Lib.cpp(161) : error C2061: syntax error : identifier '_Function_1_1'
./src/nme/Lib.cpp(161) : error C2065: 'inHeight1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2065: 'inColour1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2065: 'inWidth1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2065: 'inFrameRate1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2065: 'inWidth1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2227: left of '->__get' must point to class/stru
ct/union/generic type
type is ''unknown-type''
./src/nme/Lib.cpp(161) : error C2065: 'inHeight1' : undeclared identifier
./src/nme/Lib.cpp(161) : error C2227: left of '->__get' must point to class/stru
ct/union/generic type
type is ''unknown-type''
./src/nme/Lib.cpp(161) : error C2143: syntax error : missing ';' before ')'
./src/nme/Lib.cpp(161) : error C3861: 'create_main_frame': identifier not found
./src/nme/Lib.cpp(161) : error C2143: syntax error : missing ';' before ')'
./src/nme/Lib.cpp(158) : error C3861: 'run': identifier not found
./src/nme/Lib.cpp(158) : error C3861: 'run': identifier not found
./src/nme/Lib.cpp(163) : error C2059: syntax error : 'return'
./src/nme/Lib.cpp(167) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(167) : error C3861: 'create': identifier not found
./src/nme/Lib.cpp(167) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(167) : error C3861: 'create': identifier not found
./src/nme/Lib.cpp(167) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(169) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(182) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(182) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(182) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(184) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(196) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(196) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(196) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(198) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(208) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(208) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(208) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(210) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(217) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(217) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(217) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(219) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(231) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(231) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(231) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(233) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(243) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(243) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(243) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(245) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(262) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(262) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(262) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(264) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(266) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(268) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(271) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(272) : error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int
./src/nme/Lib.cpp(273) : warning C4508: 'Lib_obj' : function should return a val
ue; 'void' return type assumed
./src/nme/Lib.cpp(275) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(281) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(285) : error C2065: 'VSYNC' : undeclared identifier
./src/nme/Lib.cpp(286) : error C2065: 'HW_AA' : undeclared identifier
./src/nme/Lib.cpp(296) : error C2065: 'sIsInit' : undeclared identifier
./src/nme/Lib.cpp(299) : error C2065: 'HARDWARE' : undeclared identifier
./src/nme/Lib.cpp(300) : error C2065: 'nmeStage' : undeclared identifier
./src/nme/Lib.cpp(304) : error C2065: 'RESIZABLE' : undeclared identifier
./src/nme/Lib.cpp(305) : error C2065: 'initWidth' : undeclared identifier
./src/nme/Lib.cpp(308) : error C2065: 'FULLSCREEN' : undeclared identifier
./src/nme/Lib.cpp(309) : error C2065: 'BORDERLESS' : undeclared identifier
./src/nme/Lib.cpp(310) : error C2065: 'nmeCurrent' : undeclared identifier
./src/nme/Lib.cpp(311) : error C2065: 'initHeight' : undeclared identifier
./src/nme/Lib.cpp(314) : error C2065: 'HW_AA_HIRES' : undeclared identifier
./src/nme/Lib.cpp(319) : error C2065: 'nmeMainFrame' : undeclared identifier
./src/nme/Lib.cpp(332) : error C2653: 'super' : is not a class or namespace name
./src/nme/Lib.cpp(335) : error C2653: 'Lib_obj' : is not a class or namespace na
me
./src/nme/Lib.cpp(339) : error C2065: 'VSYNC' : undeclared identifier
./src/nme/Lib.cpp(340) : error C2065: 'HW_AA' : undeclared identifier
./src/nme/Lib.cpp(341) : error C2065: 'stage' : undeclared identifier
./src/nme/Lib.cpp(344) : error C2065: 'current' : undeclared identifier
./src/nme/Lib.cpp(345) : error C2065: 'sIsInit' : undeclared identifier
./src/nme/Lib.cpp(348) : error C2065: 'HARDWARE' : undeclared identifier
./src/nme/Lib.cpp(349) : error C2065: 'nmeStage' : undeclared identifier
./src/nme/Lib.cpp(352) : error C2065: 'RESIZABLE' : undeclared identifier
./src/nme/Lib.cpp(353) : error C2065: 'initWidth' : undeclared identifier
./src/nme/Lib.cpp(356) : error C2065: 'FULLSCREEN' : undeclared identifier
./src/nme/Lib.cpp(357) : error C2065: 'BORDERLESS' : undeclared identifier
./src/nme/Lib.cpp(357) : fatal error C1003: error count exceeds 100; stopping co
mpilation
c:__projectshaxedevgraphics1>
Speaker-to-Animals,
I know it’s a bit late, but it looks like you have a versions mismatch between haxe and hxcpp. Id you are using an overnight build of haxe, you need the svn version of HXCPP.
Huge
Hello,
Just wanted to say great work on everything. I’ve been trying to wrap my head around knowing when users hit the home button on android. I looked at GameActivity and have had no luck considering I do not know Java, and if I did, I do not know how to cross that with coding in haxenme. If you could point me in the right direction that would be great
Hi,
Sorry about the late reply – I’ve had a bit of time away from the blog. I think the answer you are after is the “DEACTIVATE” event. You can look over haxenme.org for more help.
hello Huge:
when i run 02-Text ,use this command“haxe -main Sample -cpp bin -lib nme” ,found error,
It display“Sample.hx:1: characters 0-17 : You can’t access the flash package with current c
ompilation flags (for flash.Lib)” my nme version:3.4,
when i run the command“haxe -main Sample -cpp bin -lib nme –remap flash:nme”,It can build,but exe can not run,why?
Hi,
The “new” way of compiling this sample is:
nme test Sample.nmml cpp
The this command will add the remap (make it compile)), and also add code to create the stage for you (stop it crashing).
How can I target Android *without* the nme part? How can I make an haxe activity to run on Android? Yes, I will write the CFFI part or whatever needed to make this haxe activity doing something useful. just I want to find how to compile for Android without the NME. (reason is that I want to make own game engine that is not flash-like)
Hi,
Well, you can get hxcpp to compile to a .so file and just use that like any other shared object. Ie write your own java/jni files. This is really all that NME is doing – all the source code is there so you can tak as much or as little of it as you want.
NME provides a number of helpers you might want to use.
If you implement the jni function in templates/default/android/template/src/org/haxe/nme/NME.java in your own “NME.ndll”, and change the “ApplicationMain” template, you can make use of most of the nme infrastructure without using any of the library code.
Alternatively, you could look at sample 22, and create a single child of the stage and make your own abstractions with this in haxe, while taking advantage of the library that is already there (assets/image/audio/url/ogl context/keyboard etc etc).