积极答复者
error LNK2019: 无法解析的外部符号 "__

问题
-
用的vs2005
//main.cpp
#include "OFELI.h"
using namespace OFELI;
int main(int argc, char *argv[])
{
double Lmin=0, Lmax=1;
int N = 50;
double f(double x);
double error(const Mesh &ms, const Vect<double> &u);// Read and output mesh data
banner();
if (argc > 1)
N = atoi(argv[1]);
Mesh ms(Lmin,Lmax,N);
int NbN = N+1;// Declare problem data (matrix, rhs, boundary conditions, body forces)
TrMatrix<double> A(NbN);
Vect<double> b(NbN);// Build matrix and R.H.S.
double h = (Lmax-Lmin)/double(N);
for (int i=2; i<NbN; i++) {
double x = ms.getNode(i).getCoord(1);
A(i,i) = 2./h;
A(i,i+1) = -1./h;
A(i,i-1) = -1./h;
b(i) = f(x)*h;
}// Impose boundary conditions
A(1,1) = 1.;
A(1,2) = 0.;
b(1) = 0;
b(NbN) = 0;
A(NbN,NbN) = 1.;
A(NbN-1,NbN) = 0.;// Solve the linear system of equations
A.Solve(b);// Output solution and error
cout << "\nSolution:\n" << b;
cout << "Error = " << error(ms,b) << endl;return 0;
}
double f(double x)
{
double a = 10;
return 2*a*(1-2*a*x*x)*exp(-a*x*x);
}
double error(const Mesh &ms, const Vect<double> &u)
{
double err=0;
double a = 10;
for (size_t i=1; i<=u.getSize(); i++) {
double x = ms.getNode(i).getCoord(1);
err = max(err,fabs(u(i) - exp(-a*x*x) - x*(1-exp(-a)) + 1));
}
return err;
}
==========================//mesh.h
#ifndef __MESH_H
#define __MESH_H#include <vector>
#include <valarray>
using std::vector;
using std::valarray;#include "OFELI_Config.h"
#include "OFELI_Macros.h"
#include "Point.h"
#include "Element.h"
#include "Side.h"
#include "Edge.h"namespace OFELI {
class Mesh
{public:
Mesh(const string &file, bool bc=false, int opt=NODE_DOF);
Mesh(const Grid &g, int opt=QUADRILATERAL);
...
Mesh(const Mesh &ms);
~Mesh();
...
}
=========================
1>正在链接...
1>main.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall OFELI::Mesh::~Mesh(void)" (??1Mesh@OFELI@@QAE@XZ),该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall OFELI::Mesh::Mesh(double,double,unsigned int,unsigned int,unsigned int)" (??0Mesh@OFELI@@QAE@NNIII@Z),该符号在函数 _main 中被引用
1>D:\C++_doc\5\Debug\5.exe : fatal error LNK1120: 2 个无法解析的外部命令
1>生成日志保存在“file://d:\C++_doc\5\5\Debug\BuildLog.htm”
1>5 - 3 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========问题困扰好久了,望大虾们指点