请教为什么我把main函数放在另一个文件里,引用另一个文件类的时候总出现连接错误
这是//matrix。h
class CMatrix
{
private:
//double **mvalue;
int m_nRow;
int m_nCol;
public:
double **mvalue;
CMatrix();
CMatrix(int nRow,int nCol);
CMatrix(int nRow,int nCol,double dBuf);
CMatrix(const CMatrix &mat);
~CMatrix();
bool MatInv();
CMatrix operator*(const CMatrix&m);
CMatrix& operator*=(const CMatrix&m);
CMatrix& operator*=(double dBuf);
CMatrix operator*(double dBuf);
CMatrix operator+(const CMatrix&m);
CMatrix& operator+=(const CMatrix&m);
CMatrix& operator =(double dBuf);
CMatrix& operator=(const CMatrix&m);
CMatrix& Trans(const CMatrix&m);
void Realloc (int nRow,int nCol);
double & operator()(int iRow,int iCol)
{
return mvalue[iRow][iCol];
}
int GetCol() {return m_nCol;}
int GetRow() {return m_nRow;}
void setvalue();
};
//这是main,cpp
#include "matrix.h"
#include "iostream"
#include <stdio.h>
//--------------------
void main(){
CMatrix ss(2,2,0);
};
连接错误:
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CMatrix::~CMatrix(void)" (??1CMatrix@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CMatrix::CMatrix(int,int,double)" (??0CMatrix@@QAE@HHN@Z