关于LNK2001的问题,请高手指点

九个太阳2023 2008-02-26 10:21:45
该程序就是对"abc.txt"里的数据的最大公约数进行排序,然后输出,附"abc.txt"文件:
12 35
77 91
123 789
24 28
64 112
1024 888
98 54

************************************************下面是我的程序
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

int DivisorNumber(int x,int y);
void InputData(VVI&);
void print(VI&);
vector<int> Fun(vector<VI>& a);

int main()
{
VVI matrix;
InputData(matrix);

VI Vec;
Vec = Fun(matrix);
sort(Vec.begin(),Vec.end());
print(Vec);

return 0;
}

//求取两个整数的最大公约数
int DivisorNumber(int x,int y)
{
//辗转相除法
int m,n,t;
if (x > y)
{
m = x;
n = y;
}
else
{
m = y;
n = x;
}

while (m % n != 0)
{
t = n;
n = m%n;
m = t;
}

return n;
}

void InputData(VVI&m)
{
ifstream in("abc.txt");
int t;
m.resize(7);
for (string s;getline(in,s);)
{
for (istringstream sin(s);sin>>t;m[m.size()-8].push_back(t));
}
}

vector<int> Fun(vector<VI>& a)
{
vector<int> c(7);

for (int i = 0; i < 7; ++i)
{
c[i] = DivisorNumber(a[i][0],a[i][1]);
}

return c;
}

在编译的时候出现下列错误:
Deleting intermediate files and output files for project 'Ex0503 - Win32 Debug'.
--------------------Configuration: Ex0503 - Win32 Debug--------------------
Compiling...
Ex0503.cpp
Linking...
Ex0503.obj : error LNK2001: unresolved external symbol "void __cdecl print(class std::vector<int,class std::allocator<int> > &)" (?print@@YAXAAV?$vector@HV?$allocator@H@std@@@std@@@Z)
Debug/Ex0503.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...

Ex0503.exe - 2 error(s), 0 warning(s)

odbc32.lib odbccp32.lib也在路径下!

...全文
31 1 打赏 收藏 转发到动态 举报
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Supper_Jerry 2008-02-26
  • 打赏
  • 举报
回复
print函数你没有实现

63,594

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下