Compiler doesn't see template specialization?
问题 I have template in my .h file: template <typename T> void addToolsAreaItem(){ T* item = new T(_image, this); doSpecifiedStaff<T>(item); _tools.addTool(item); } and its specialization in .cpp file: template <> void ImageWorkspace::addToolsAreaItem<Preview>(){ _preview = std::make_unique<QGraphicsView>(_splitter); _imagesLayout.addWidget(_preview.get()); } Class Prewiew is empty and is used only for specialize behavior of one case (when preview button is toggled). But I get compiler error: