there doesn't seem to be a decent way to google this so here's my issue:
.cpp files include .h files. So lets say I have a class defined in range_search.h, and implement it in range_search.cpp. Not if I want to use it from another cpp file I, again, include range_search.h. This seems to be the right etiquette anyway. This way though, I'm not including the .cpp file anywhere, and currently my code is complaining about not finding the functions therein. What am I doing wrong?
Best, and thanks in advance! Alex
EDIT: As per wish:
range_search.h:
#ifndef RANGE_SEARCH_H_
#define RANGE_SEARCH_H_
namespace range_search {
template<class Point>
class RangeSearch {
public:
using value_type = Point;
virtual void assign(const std::vector<Point>& points) = 0;
};
} // namespace range_search
#endif // RANGE_SEARCH_H_
range_search.cpp:
#include "range_search.h"
namespace range_search {
/// Sets the underlying set.
void assign(const std::vector<Point>& points){
//doing stuff
}
}
main.cpp:
#include "range_search.h"
using Point = std::array<double, 2>;
int main(){
//initialize some points
range_search::RangeSearch<Point> r();
r.assign(points);
}
Error is in German unfortunately:
Fehler: Abfrage des Elementes »assign« in »r«, das vom Nicht-Klassentyp »range_search::RangeSearch >()« ist r.assign(points);
From what I can tell it's due to the fact that main.cpp has no link to range_search.cpp