0
我有兩個項目。一個創建一個DLL,另一個應該使用DLL中聲明的函數,但是我在執行這個時遇到問題。從DLL C++導入函數問題。 LNK 2001
在DLL項目中,我有這些聲明:
using namespace XClass;
extern "C" __declspec(dllexport) int Compute(XClass::XClassInput input, XClassOutput &XClassOutput);
extern "C" __declspec(dllexport) int Init(string configFileName);
class xclass
{
public:
xclass(void);
xclass(constellation &Constellation, XClass::XClassConfig &XClassConfig);
void ComputeWeightingMatrix(constellation &xclass_constellation, char flagIntCont);
void ComputeGMatrix(constellation &Constellation, XClass::XClassInput &input);
private:
int _numberOfSystemStates;
};
在具有使用DLL函數我有這樣的項目:
int _tmain(int argc, _TCHAR* argv[])
{
XClass::XClassConfig xClassConfig;
XClassOutput xClassOutput;
XClass::XClassInput input;
init(input, xClassOutput);
constellation* class_constellation = new constellation(input, xClassConfig);
xclass* algorithm = new xclass(*xclass_constellation, xClassConfig);
algorithm->ComputeWeightingMatrix(*xclass_constellation, 'i');
return 0;
}
爲ComputeWeighting矩陣函數的代碼:
void xclass::ComputeWeightingMatrix(constellation &Constellation, char flagIntCont)
{
double sigma = 0.0;
long error;
...
}
當我試圖建立我得到他的:
錯誤LNK2001:無法解析的外部符號 「市民:無效__thiscall xclass :: ComputeWeightingMatrix(類星座&,炭)」(ComputeWeightingMatrix @ xclass @@ $$ FQAEXAAVconstellation @@ d @ Z?)
那麼你的代碼爲'xclass :: ComputeWeightingMatrix'? –
它與函數的內容有關嗎?或只是其聲明? – DCuser
它的定義在哪裏,你如何構建代碼? ] –