私は SWIG を使用した C++ と Lisp の間のインターフェースの初心者です。SWIG のドキュメントに従っていますが、問題に直面しています。これは私がインターフェースしたい単純なプログラムです (Lisp で簡単に実行できますが、C++ コードを Lisp にインポートする方法を理解する必要があります):
test.cpp:
#include "test.hpp"
int test(int x, int y) {
std::cout << x+y;
return 0;
}
test.hpp:
#include <iostream>
int test(int x, int y);
SWIG を使用するために、インターフェイス ファイルを作成します。
test.i:
%module test
%include <test.hpp>
そして、次のコマンドラインを実行しました:
$ swig -c++ -cffi test.i
$ c++ -c test_wrap.cxx
しかし、test_wrap.cxx をコンパイルすると、ターミナルには次のように表示されます。
test_wrap.cxx:193:19: error: use of undeclared identifier 'test'
result = (int)test(arg1,arg2);
^
1 error generated.
誰でもそれで私を助けることができますか?