我試圖使用Haxe中的Windows API來創建Windows應用程序。我已經使用ndlls和Haxe/Neko完成了這項工作。 我試着用cpp目標來做它,我使用Haxe 2.09中的新宏特性將C++代碼嵌入到Haxe文件中。但是,只要我有windows.h
它給出了一個錯誤Haxe和Windows API
./src/Main.cpp(79) : error C2039: 'RegisterClassA' : is not a member of 'hx'
./src/Main.cpp(81) : error C2660: 'RegisterClassA' : function does not take 9 arguments
Called from ? line 1
Called from BuildTool.hx line 1246
Called from BuildTool.hx line 554
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 785
Uncaught exception - Error in building thread
Error : Build failed
Build halted with errors (haxe.exe).
這裏是我的代碼 -
import cpp.Lib;
@:headerCode("#include <windows.h>")// if i comment this line or replace windows.h with another standard header file like iostream, the error goes
class Main
{
static function main()
{
//no code here
}
}
事實上,如果我從Windows或DirectX SDK的頭文件替換windows.h
,我得到相同的錯誤 即時通訊使用Haxe 2.09和FlashDevelop。我使用Windows 7.我也使用最新版本的hxcpp(版本2.09)。
我明白你的意思。這說得通。但是,我需要改變你給我的代碼。我不得不在windows.h include之前放置undef語句。否則,它會出現相同的錯誤。你能解釋一下爲什麼。無論如何非常感謝您的幫助。我真的很感激它。 – carboncopy 2012-04-16 04:01:06
@bharu:之前?不,我真的無法解釋......對不起! ;-) – Cameron 2012-04-16 13:40:01
@bharu:我能想到的唯一解釋是,也許頭代碼以相反的順序被注入......但這沒有多大意義。 – Cameron 2012-04-16 14:29:23