2017-03-01 4 views
0

Golangで消費する静的ライブラリ(* .a)のswigでラッパーを作成しようとしています。swig:__cplusplusは-C++で設定されていませんか?

私は、次のオプションをがぶ飲みを呼び出すためにGolangをトリガーmylib.swigcxxファイル使用しています:

%module mylib 
%{ 
    // (snip) 
    #include "basic/internal/config.h" 
    #include "basic/internal/config_autogen.h" 
    // (snip) 
%} 

%include <typemaps.i> 
%include "std_string.i" 
%include "std_vector.i" 

// This will create 2 wrapped types in Go called 
// "StringVector" and "ByteVector" for their respective 
// types. 
namespace std { 
    %template(StringVector) vector<string>; 
    %template(ByteVector) vector<char>; 
} 

// ... 
%include "basic/internal/config.h" 
%include "basic/internal/config_autogen.h" 
// ... 

私はラップしようとしています大規模なライブラリを:mylib.swigcxxがどのように見える

swig -go -cgo -intgosize 64 -module mylib \ 
-o $WORK/mylib/_obj/mylib_wrap.cxx \ 
-outdir $WORK/mylib/_obj/ \ 
-I/mylib/lib \ 
-c++ mylib.swigcxx 

を次のコードのヘッダーファイルがあります。

70 // C++11 standard 
    71 
    72 #if __cplusplus < 201103 
    73 
    74 #if defined(_MSC_VER) 
    75 #if _MSC_VER < 1700 
    76 #error "Compiling OGDF requires Visual C++ 11 (Visual Studio 2012) or higher!" 
    77 #endif 
    78 
    79 #elif defined(__GNUC__) 
    80 #ifndef __GXX_EXPERIMENTAL_CXX0X__ 
    81 #error "No C++11 support activated for g++ (compile with -std=c++0x or -std=c++11)!" 
    82 #endif 
    83 
    84 #else 
    85 #error "Compiling OGDF requires a C++11 compliant compiler!" 
    86 #endif 
    87 
    88 #endif 
    89 

可能な限り__cplusplusが正しく設定されているか、エラーを表示しないかを確認しています。私はSWIG実行中に取得

エラーがある:あなたが見ることができるように、それは__cplusplus < 201103用ライン85とelse句に失敗しています

/mylib/lib -c++ mylib.swigcxx 
/mylib/lib/basic/internal/config.h:85: Error: CPP #error ""Compiling OGDF requires a C++11 compliant compiler!"". Use the -cpperraswarn option to continue swig processing. 
/mylib/lib/basic/internal/config.h:254: Error: CPP #error ""OGDF is compiled without LP solver. Check your build configuration."". Use the -cpperraswarn option to continue swig processing. 
/mylib/lib/basic/internal/config.h:299: Error: CPP #error ""OGDF is compiled without memory manager. Check your build configuration."". Use the -cpperraswarn option to continue swig processing. 

the SWIG 3.0 docs, this should be set with the -c++ flagによると

__cplusplus      Defined when -c++ option used 

任意の助けいただければ幸いです。あなたの.iファイル内の次の追加

答えて

0

私は__cplusplusが定義されていると思われるが、その値未満201103.

では、あなたのライブラリーのニーズが実際にSWIGでサポートされているC++ 11個の機能場合は、これを解決するべきです。

#undef __cplusplus 
#define __cplusplus 201103 
関連する問題