编译链接错误

kevinhcj 2007-08-31 12:41:36
我是新手,写了一个project,包含若干文件,每个都已经单独编译成功,包括含main()函数的文件MAIN.cpp,最后链接build MAIN.cpp出现了很多错误:

LINK : warning LNK4224: /PDBTYPE is no longer supported; ignored
DigOut.obj : error LNK2005: "public: __thiscall Mathematics::MakOrder::MakOrder(void)" (??0MakOrder@Mathematics@@QAE@XZ) already defined in ContVol.obj
DigOut.obj : error LNK2005: "public: __thiscall Mathematics::MakOrder::MakOrder(unsigned int,unsigned int)" (??0MakOrder@Mathematics@@QAE@II@Z) already defined in ContVol.obj
DigOut.obj : error LNK2005: "public: class Mathematics::TMatrix<unsigned int> const & __thiscall Mathematics::MakOrder::GntOrder(void)const " (?GntOrder@MakOrder@Mathematics@@QBEABV?$TMatrix@I@2@XZ) already defined in ContVol.obj

以前没有写过project,请大家指点一下
顺便说一下,我的每个.h文件都有

#pragma once

#ifndef *_H
#define *_H
//...
#endif
...全文
186 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
blackmurder 2007-08-31
  • 打赏
  • 举报
回复
有没有include啊
kevinhcj 2007-08-31
  • 打赏
  • 举报
回复
希望高手不要不屑于回答这样的问题哦,我市新手,请大家多多知道,谢谢了!
kevinhcj 2007-08-31
  • 打赏
  • 举报
回复
我的每个.h文件都有

#pragma once

#ifndef *_H
#define *_H
//...
#endif
lfcai 2007-08-31
  • 打赏
  • 举报
回复
那用#ifdef给它宏定义啊
kevinhcj 2007-08-31
  • 打赏
  • 举报
回复
#include <iostream>
#include "StaticFinitVol.h"

using namespace DynamicFv;

int main()
{
TMatrix<Point<> > matF;
TMatrix<Point<> > matS;

ifstream fif("PF.txt");
ifstream fis("PS.txt");

ofstream fof("QF.txt");
ofstream fos("QS.txt");

matF.TMin(fif, matF);
matS.TMin(fis, matS);

// Parameters
REAL dis = 2.103;
Point<> Porin(0, 0);
Point<size_t> Pfirst(3, 3);
size_t dim[2] = {7, 7};

StaticFinitVol SFV(dis, Porin, Pfirst, dim, matF, matS);

return 0;
}

从这个文件应该看不错问题:)
我还特意画过结构图,发现没有漏#include,(否则编译也通不过阿),我怀疑是不是重复包含的关系,但是 有点文件不得不间接的重复包含阿,至于直接的包含,我已经做到最小了。
endbeginer 2007-08-31
  • 打赏
  • 举报
回复
看看代码吧,至少是Main的代码

33,319

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧