extern classes for C++ classes

86 views
Skip to first unread message

Serg Omarov

unread,
Jun 10, 2015, 9:08:25 AM6/10/15
to haxe...@googlegroups.com
Excuse me if my questions are too bold .
I tried to make extern class for this class c ++:
class Test
{
  public:
	  static Test instance;
	  static Test createInstance(){
		  return Test.instance=new Test();
	  }
	  int Num;
	  Test(){
		  
	  }
};
this is extern class:
package;
@:structAccess
@:include("Test.cpp")
@:native("Test")
extern class Test {
	public static function createInstance():Test;
	public static var instance:Test;
    public var Num:Int;
}
In general, the compilation starts without oshiok , but then :
Running Pre-Build Command Line...
cmd: "C:\HaxeToolkit\haxe/haxelib" run lime build "project.xml" windows -release -Dfdb
cl.exe -Iinclude -nologo -O2 -DHX_WINDOWS -D_USING_V120_SDK71_ -GR -Oy- -c -EHs -GS- -arch:SSE -IC:/HaxeToolkit/haxe/lib/hxcpp/3,2,94/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -D_CRT_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -DHX_WIN_MAIN -wd4996 -MT ./src/Main.cpp -Foobj/msvc-ncxp/57588eaa_Main.obj
Main.cpp
./src/Main.cpp(3) : fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о祭ЁҐ: Test.cpp: No such file or directory

Build halted with errors.
I'll be glad to get help.

Hugh

unread,
Jun 11, 2015, 12:50:32 AM6/11/15
to haxe...@googlegroups.com
Hi,
If you put your "Test.cpp" class next to your "Test.hx" file, then using @:include("./Test.cpp") should do the trick. (Note: "./" in the filename)

Hugh
Reply all
Reply to author
Forward
0 new messages