gpt4 book ai didi

c++ - 未解析的外部符号

转载 作者:行者123 更新时间:2023-11-30 04:15:35 26 4
gpt4 key购买 nike

<分区>

Error 1 error LNK2019: unresolved external symbol "bool __cdecl prefix(unsigned int,unsigned int)" (?prefix@@YA_NII@Z) referenced in function _main c:\Users\Work\documents\visual studio 2012\Projects\Book\Project5\Project5\Source.obj Project5

Error 2 error LNK1120: 1 unresolved externals c:\users\work\documents\visual studio 2012\Projects\Book\Project5\Debug\Project5.exe 1 1 Project5

我只是..我什至不知道我要问你们什么。我该如何解决这个问题?

这是代码:

#include <iostream>
#include <string>
#include <vector>
#include <math.h>


using namespace std;

void citire(vector<unsigned int> myVector,int &nrElem);
bool prefix(unsigned int nr1,unsigned int nr2);

int main(){
int nrElem={0};
vector<unsigned int> myVector;


//citire(myVector,nrElem);
cout << prefix(123,1234);

system("pause");
return 0;
}

void citire(vector<unsigned int> myVector,int &nrElem){
cout << "NumarElemente=" ;
cin >> nrElem ;

for(int i=0;i<nrElem;i++){
unsigned int nrCitit;
cout << "Elem #" << i+1 <<"=";
cin >> nrCitit;
myVector.push_back(nrCitit);
};

for(int i=0;i<nrElem;i++){
cout << myVector.at(i);
};
}

bool prefix(unsigned int &nr1,unsigned int &nr2){
unsigned int nr1copy=nr1;
unsigned int nr2copy=nr2;
int digitsNr1 = 0; while (nr1copy != 0) { nr1copy /= 10; digitsNr1++; }
int digitsNr2 = 0; while (nr2copy != 0) { nr2copy /= 10; digitsNr1++; }
if ( nr2/_Pow_int(10,digitsNr2-digitsNr1)==nr1) {return true;}
else return false;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com