Home > Back-end >  Compile link problem
Compile link problem

Time:10-17

 
//////////////////////////
//the Fibonacci. H
/////////////////////
# include
# include
using namespace std;
The class Solution {
Public:
Int the Fibonacci (int number);
Void the print ();//{cout & lt; <"This is the Fibonacci" & lt; };

 
///////////////
//the Fibonacci. CPP
//////////////////////
# include "Fibonacci. H"
{int Solution: the Fibonacci (int number)
Number=number - 1;
The switch (number) {
Case 0:
return 0;
Case 1:
Case 2:
return 1;
}
Int temp.
Temp=1/SQRT (5) * (pow (((1 + SQRT (5))/2), the number) -
Pow (((1 - SQRT (5))/2), the number));
Return temp.
}
Void Solution: : print () {
Cout & lt; <"This is the Fibonacci" & lt; }

 
///////////////
//testfib. CPP
/////////////
# include "Fibonacci. H"
Int main () {
int n;
Solution fib.
Cout & lt; <"Both please input n:";
Fib. Print ();
Cin & gt;> n;
Cout & lt; return 0;
}


Question:
 
Perform the g + + Fibonacci. CPP - o libfib. So the -fpic -shared
Generate libfib. So
G + + compiler - o testlib testfib. O - L - llibfib
Times wrong.
Prompt undefined reference to "Solution: : print ()"

Please answer

CodePudding user response:

- lfib? The library files into the wrong way
  • Related