SWIG为BWAPI库(C+;+;)生成CFFI包装时出错 我试图通过修改另一个BWAPI桥(它是用C语言编写的)来为BWAPI编写一个CFFI包装(它是用C++编写的)。p>

SWIG为BWAPI库(C+;+;)生成CFFI包装时出错 我试图通过修改另一个BWAPI桥(它是用C语言编写的)来为BWAPI编写一个CFFI包装(它是用C++编写的)。p>,c++,common-lisp,wrapper,swig,C++,Common Lisp,Wrapper,Swig,我的操作系统:Windows7专业版 SWIG版本:2.0.3 UAC:关 (*如果我没有在%include part:中指定/std文件夹,则出现错误代码) 更新:Linux上出现相同错误: 在带有SWIG 2.0.3的窗口上 以下是我的BuildInterface.bat的内容,它是从原始版本修改而来的: :start erase /s /q Classes\*.* erase /s /q Wrapper\*.* swig.exe -cffi -c++ -I..\BWAPI\

我的操作系统:Windows7专业版

SWIG版本:2.0.3

UAC:关

(*如果我没有在%include part:中指定/std文件夹,则出现错误代码)

  • 更新:Linux上出现相同错误:

  • 在带有SWIG 2.0.3的窗口上

以下是我的
BuildInterface.bat
的内容,它是从原始版本修改而来的:

:start 

erase /s /q Classes\*.*
erase /s /q Wrapper\*.*

swig.exe -cffi  -c++ -I..\BWAPI\Include  -outdir Classes\BWAPI  -o Wrapper\bwapi-bridge.cxx Interfaces\bwapi-bridge.i

swig.exe -cffi -c++ -I..\BWAPI\Include -outdir Classes\BWTA  -o Wrapper\bwta-bridge.cxx Interfaces\bwta-bridge.i

swig.exe -cffi -c++ -I..\BWAPI\Include  -outdir Classes\BWAPIC   -o Wrapper\bwapiclient-bridge.cxx Interfaces\bwapiclient-bridge.i

pause
goto start
以及修改后的
bwapi桥.i

%include "cpointer.i"
%include "carrays.i"
//include headers in our generated code.
%module bwapi
%{
#include "BWAPI.h"

using namespace BWAPI;
%}                    

//special include for our dllimport attribute
%include "dllimport.i"


//resolve ambiguities
%include "ambiguities.i"

//unimplemented functions in headers (or ones that should not be called)
//uncomment these each new version of BWAPI to ensure they are not later implemented.
#%ignore getPlayerUnits;
#%ignore BWAPI::GameData::GameData;

//fix up operator overrides.
%rename (opAssign) *::operator =;
%rename (opEquals) *::operator ==;
%rename (opLessThan) *::operator <;
%rename (opGreaterThan) *::operator >;
%rename (opMinus) *::operator -;
%rename (opNotEquals) *::operator !=;                         
%rename (opPlus) *::operator +;
%rename (opAdd) *::operator +=;
%rename (opSubtract) *::operator -=;

//fix up const strings.
%apply const  string & { string &};


%include "BWAPI.h"
%include "BWAPI/EventType.h"
%include "BWAPI/GameType.h"
%include "BWAPI/Race.h"
%include "BWAPI/TechType.h"
%include "BWAPI/UpgradeType.h"
%include "BWAPI/Position.h"
%include "BWAPI/AIModule.h"
%include "BWAPI/Color.h"
%include "BWAPI/Constants.h"
%include "BWAPI/CoordinateType.h"
%include "BWAPI/DamageType.h"
%include "BWAPI/Error.h"
%include "BWAPI/ExplosionType.h"
%include "BWAPI/Flag.h"
%include "BWAPI/Force.h"
%include "BWAPI/Input.h"
%include "BWAPI/Event.h"
%include "BWAPI/Latency.h"
%include "BWAPI/Order.h"
%include "BWAPI/PlayerType.h"
%include "BWAPI/Player.h"
%include "BWAPI/BulletType.h"
%include "BWAPI/Bullet.h"
%include "BWAPI/TilePosition.h"
%include "BWAPI/UnitCommandType.h"
%include "BWAPI/UnitCommand.h"
%include "BWAPI/Game.h"
%include "BWAPI/Unit.h"
%include "BWAPI/UnitSizeType.h"
%include "BWAPI/UnitType.h"
%include "BWAPI/WeaponType.h"

%include "std/std_vector.i"
%include "std/std_set.i"
%include "std/std_pair.i"
%include "std/std_list.i"
%include "std/std_map.i"

//Instantiate our templates
namespace std {
%template (PositionVector)vector<BWAPI::Position>;
%template (BulletPtrSet)  set<BWAPI::Bullet *>;
%template (BulletTypeSet) set<BWAPI::BulletType>;
%template (DamageTypeSet) set<BWAPI::DamageType>;
%template (ErrorSet)  set<BWAPI::Error>;
%template (ExplosionTypeSet) set<BWAPI::ExplosionType>;
%template (ForcePtrSet)  set<BWAPI::Force *>;
%template (GameTypeSet)  set<BWAPI::GameType>;
%template (OrderSet)  set<BWAPI::Order>;
%template (PlayerPtrSet)  set<BWAPI::Player *>;
%template (PlayerTypeSet)  set<BWAPI::PlayerType>;
%template (RaceSet)  set<BWAPI::Race>;
%template (TechTypeSet)  set<BWAPI::TechType>;
%template (TilePositionSet)  set<BWAPI::TilePosition>;
%template (UnitPtrSet)  set<BWAPI::Unit*>;
%template (UnitCommandTypeSet)  set<BWAPI::UnitCommandType>;
%template (UnitSizeTypeSet)  set<BWAPI::UnitSizeType>;
%template (UnitTypeSet)  set<BWAPI::UnitType>;
%template (UpgradeTypeSet)  set<BWAPI::UpgradeType>;
%template (WeaponTypeSet)  set<BWAPI::WeaponType>;
%template (EventList)  list<BWAPI::Event>;
%template (UnitTypeList)  list<BWAPI::UnitType>;
%template (TilePositionDoubleMap)  map<BWAPI::TilePosition, double>;
%template (UnitTypeIntMap)  map<BWAPI::UnitType, int>;
%template (PositionPair)  pair<BWAPI::Position,BWAPI::Position>;
%template (TilePositionDoublePair)  pair<BWAPI::TilePosition, double>;
%template (UnitTypeIntPair)  pair<BWAPI::UnitType,int>;
%template (TilePositionVector)  vector<BWAPI::TilePosition>;
%template (PositionSet)  set<BWAPI::Position>;
};
%include "cpointer.i"
%module bwta
%{
#include "BWAPI.h"
#include "BWTA.h"

using namespace BWTA;
%}                  
//use getcolumn instead
%ignore operator[];

//import BWAPI
%import "bwapi-bridge.i"


//BWTA order of includes is important to stop SWIGTYPE_p etc class generation with and without namespace
%include "BWTA/RectangleArray.h"
%include "BWTA/BaseLocation.h"
%include "BWTA/Chokepoint.h"
%include "BWTA/Polygon.h"
%include "BWTA/Region.h"
%include "BWTA.h"


%module bwta-bridge
%include "std/std_vector.i"

%include "std/std_set.i"

%include "std/std_pair.i"




//Instantiate our templates

%template (RectangleArrayDouble) BWTA::RectangleArray<double>; 


namespace std {

    %template (BaseLocationPtrSet) set<BWTA::BaseLocation *>;
        %template (RegionPtrSet)       set<BWTA::Region *>;
        %template (ChokepointPtrSet)   set<BWTA::Chokepoint *>;
        %template (PolygonPtrSet)      set<BWTA::Polygon *>;
        %template (PolygonVector)      vector<BWTA::Polygon>;
        %template (RegionPtrRegionPtrPair) pair<BWTA::Region *, BWTA::Region *>;
}
;
您可以使用任何svn客户端从我上面列出的2个页面下载原始src代码。 非常感谢。
请帮忙

好的。。。把它和至少30个字符的正文一起扔掉。

你可以通过#IRC频道:IRC.quakenet:#b如果你的回答没有任何意义啊,我终于想出了办法:p