私は、c++ Test クラスを cythonize する簡単な例を実行しようとしています。私はそれを働かせることができません、なぜですか?
これが私のコードで、非常に基本的です:
mytest.h:
class Test
{
public:
Test(unsigned test = 0);
void print();
private:
unsigned m_test;
};
mytest.cpp:
#include "mytest.h"
#include <iostream>
using namespace std;
Test::Test(unsigned test)
: m_test(test)
{
cout << "Test::Test" << endl;
}
void Test::print()
{
cout << "print:" << m_test << endl;
}
Cython の部分については、test.pyxがあります。
cdef extern from "mytest.h":
cdef cppclass Test:
Test(unsigned int) except +
void print()
cdef class pyTest:
cdef Test* thisptr
def __cinit__(self, unsigned test):
self.thisptr = new Test(test)
def __dealloc__(self):
del self.thisptr
そして、私は次のようにコンパイルします:
cython --cplus test.pyx
...そして、「空の宣言子」のような大量のエラーメッセージを取得します:
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> cdef extern from "mytest.h":
> cdef cppclass Test:
> Test(unsigned int) except +
> void print()
> ^
> ------------------------------------------------------------
>
> test.pyx:4:7: Empty declarator
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> cdef extern from "mytest.h":
> cdef cppclass Test:
> Test(unsigned int) except +
> void print()
> ^
> ------------------------------------------------------------
>
> test.pyx:4:7: Syntax error in C variable declaration
何が表示されないのですか?
ありがとう