怎么会有两个error呢,请大虾帮忙

cardin 2002-02-02 06:01:19
// 8848.cpp : Defines the entry point for the console application.
//Linking...
8848.obj : error LNK2001: unresolved external symbol "bool __cdecl fibon_elem(int,int &)" (?fibon_elem@@YA_NHAAH@Z)
Debug/8848.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

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


#include "stdafx.h"
#include <iostream>
using namespace std;
bool fibon_elem(int ,int &);

int main(int argc, char* argv[])
{

int pos;
cout << "please enter a postion: ";
cin >> pos;

int elem;
if (fibon_elem(pos,elem))
cout << " element # "<< pos
<< " is " << elem << endl;
else cout << "sorry, could not calculate element # "
<< pos << endl;
bool fibon_elem(int pos,int &elem);
{ //检查位置值合理否
if ( pos <= 0 || pos > 1024 )
{ elem =0 ;return false;}
elem =1;
//位置为1和2时候,elem的值都为1
int n_1=1, n_2=1;
for (int ix =3; ix <= pos; ++ix)
{
elem =n_1+n_2;
n_2=n_1;n_1 =elem;
}
return true ;
}
}


...全文
87 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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