I wrote a piece of software in C++ OpenCV, that's so structured:
- main.cpp
- testfps.cpp
- testfps.hpp
The problem is that I get the these two errors
undefined reference to "myTestfps1(int, int)"
undefined reference to "myTestfps2(int, int)"
These two method are written in testfps.cpp and declared in testfps.hpp.
In main.cpp are declared all the necessary #include <name>
, and after them there is #include "testfps.hpp"
main.cpp
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "testfps.hpp"
int main(int argc, char** argv[]){
....
switch(c){
case 1: myTestfps1(a,b);break;
case 2: myTestfps2(a,b);break;
}
...
}
testfps.cpp
#include <opencv2/opencv.hpp>
#include <time.h>
#include <stdio.h>
#include "testfps.hpp"
int myTestfps1(int a, int b){
...
}
int myTestfps2(int a, int b){
...
}
testfps.hpp
#ifndef TESTFPS_HPP
#define TESTFPS_HPP
int myTestfps1(int a, int b);
int myTestfps2(int a, int b);
#endif
What's wrong with this?