This could also happen if you are using CMake. If you have created a new class and you want to instantiate it, at the constructor call you will receive this error -even when the header and the cpp
files are correct- if you have not modified CMakeLists.txt
accordingly.
With CMake, every time you create a new class, before using it the header, the cpp
files and any other compilable files (like Qt ui
files) must be added to CMakeLists.txt
and then re-run cmake .
where CMakeLists.txt
is stored.
For example, in this CMakeLists.txt
file:
cmake_minimum_required(VERSION 2.8.11)
project(yourProject)
file(GLOB ImageFeatureDetector_SRC *.h *.cpp)
### Add your new files here ###
add_executable(yourProject YourNewClass.h YourNewClass.cpp otherNewFile.ui})
target_link_libraries(imagefeaturedetector ${SomeLibs})
If you are using the command file(GLOB yourProject_SRC *.h *.cpp)
then you just need to re-run cmake .
without modifying CMakeLists.txt
.