第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

無法使用 SWIG 在 Python 中實(shí)例化 C++ 類(獲取屬性錯(cuò)誤)

無法使用 SWIG 在 Python 中實(shí)例化 C++ 類(獲取屬性錯(cuò)誤)

藍(lán)山帝景 2021-07-15 18:01:38
我想將 C++ 類導(dǎo)出到 Python 中,為此我使用 SWIG 創(chuàng)建了一個(gè) C++ 擴(kuò)展模塊。從文檔中,我可以看到可以使用 SWIG 導(dǎo)出類。我能夠成功地為python創(chuàng)建類模塊(_minimal.pyd)。我可以在 Python 中導(dǎo)入模塊。但是,我無法創(chuàng)建該類的對象,并且出現(xiàn)屬性錯(cuò)誤。請找到我嘗試過的代碼示例。有人可以幫我嗎?//minimal.hclass minimal{private:    static int num_instances;public:    minimal()    {        ++num_instances;    }    ~minimal()    {        --num_instances;    }    void print_num_instances();};//minimal.cpp#include <iostream>#include "minimal.h"int minimal::num_instances = 0;void minimal::print_num_instances(){    using namespace std;    cout << this->num_instances << endl;}//minimal.i(interface file)%module minimal%{#include "minimal.h"%}%include "minimal.h"//python code used to run the moduleimport _minimal as mm1=m.minimal()
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 173 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)