Undefined reference to constructor

The error is generated by the linker because it can not see where the definition of the constructor is located.

If you are using an IDE, you should add both .cpp files to the project so that they can be compiled together and the definition would be found by the linker. It not, then you have to combine them yourself -assuming you are using gcc:

g++ cars.cpp filter.cpp

will combine them into one executable and should not show you that error

Leave a Comment