我使用痛飲包裹我的C++類在PHP的一個問題: 我班的聲明如下的頭文件:痛飲致命錯誤:不能重新聲明類
#include <string.h>
using namespace std;
class Ccrypto
{
int retVal;
public:
int verify(string data, string pemSign, string pemCert);
long checkCert(string inCert, string issuerCert, string inCRL);
int verifyChain(string inCert, string inChainPath);
int getCN(string inCert, string &outCN);
};
這些方法中的每一個由幾功能。
我的接口文件如下:
%module Ccrypto
%include <std_string.i>
%include "Ccrypto.h"
%include "PKI_APICommon.h"
%include "PKI_Certificate.h"
%include "PKI_Convert.h"
%include "PKI_CRL.h"
%include "PKI_TrustChain.h"
%{
#include "Ccrypto.h"
#include "PKI_APICommon.h"
#include "PKI_Certificate.h"
#include "PKI_Convert.h"
#include "PKI_CRL.h"
#include "PKI_TrustChain.h"
%}
我產生Ccrypto.so文件沒有任何錯誤。但是,當我用我的代碼裏面這個類我遇到這樣的錯誤:
Fatal error: Cannot redeclare class Ccrypto in /path/to/my/.php file
,當我檢查了Ccrypto.php文件我發現class Ccrypto
已申報兩次。我的意思是我有:
Abstract class Ccrypto {
....
}
和
class Ccrypto {
...
}
爲什麼痛飲生成兩個聲明我的課?
太謝謝你了 – A23149577