haXe Forum > Problem getting started with hxcpp
-
Peter Mattsson Jan 30 at 13:51
I'm trying to get a simple "Hello World" program compiled using Haxe cpp, but can't seem to get it working. The program is
class Hello { static function main() { cpp.Lib.print("Hello World!"); } }
but compiling gives
peter@HAL:~/haxe$ haxe -main Hello.hx -cpp Hello haxelib run hxcpp Build.xml haxe -Dcpp -Dhaxe_205 -Dtrue mkdir obj mkdir obj/linux mkdir obj/linux/src mkdir obj/linux/src/cpp ... snipped ... (seems OK) /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp: In member function ‘void BlockData::Verify()’: /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp:295: error: ‘printf’ was not declared in this scope /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp: In member function ‘AllocType BlockData::GetAllocType(int, bool)’: /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp:359: error: ‘printf’ was not declared in this scope /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp:373: error: ‘printf’ was not declared in this scope /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp:391: error: ‘printf’ was not declared in this scope Called from <null> line 1 Called from BuildTool.hx line 840 Called from BuildTool.hx line 433 Called from BuildTool.hx line 456 Called from BuildTool.hx line 529 Called from BuildTool.hx line 561 Called from BuildTool.hx line 166 Uncaught exception - Error : 256 - build cancelled
This is with Haxe 2.05 on Ubuntu Karmic, and GCC 4.4.1. Compiling equivalent programs to SWF/Neko/etc works fine, and there are no issues with GCC that I can see.
What am I doing wrong?
Cheers,
Peter -
Andreas Mokros Feb 04 at 22:34
Adding
#include <cstdio>
to: /usr/lib/haxe/lib/hxcpp/2,05,1//src/hx/GCInternal.cpp
works for me.Mockey
-
Peter Mattsson Feb 06 at 16:55
Ah! Thanks for that. (Though, for reference, I had to do the same thing for StdLibs.cpp as well to get it working.)
Cheers,
Peter
< Prev
| Page 1 / 1 |
Next >