i have a void function in a separate .cpp file called:
void calculate_vector.cpp
my function.cpp code:
1 2 3 4 5 6 7 8 9 10 11
|
#include <vector>
#include <iostream>
using namespace std;
void calculate_vector(vector<double>&vec1,vector<double>vec2){
//some codes;;
}
|
my main.cpp file calls for this function calculate_vector,
my main.cpp codes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <vector>
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
void calculate_vector(vector<double>&v0,vector<double>v1);
int main(){
//some codes//
....
....
....
calculate_vector(vectorA,vectorB);
}
|
i would not like to state the function codes inside my main.cpp.
why do this error occur I call the function in my main.cpp file instead of stating the function inside my main.cpp file.
I have already declared the function,
i keep getting this error:
"undefined reference to 'calculate_vector(std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >)'