I have tried to open and compile an old project in visual studio 2015 (with QT 5.7.1). The project had been implemented with visual studio 2008 and QT 4. I have do all necessary things (changed QT include paths, link *.dll versions etc). Thereafter clean all auto generated files and recompile the project. There were no any compiling errors, but it has linking errors (regarding moc files). I manually cleaned all moc files, ui_xxxx.h files and tried to build the project again. But this linking error problems were not resolved.
The linking error is below.
Error LNK2001 unresolved external symbol "public: virtual struct QMetaObject const *
__thiscall <Class Name>::metaObject(void)const " (?metaObject@<Class Name>@rules@@UBEPBUQMetaObject@@XZ) <Project Name> D:\xxxx\xxxxx\xxxxxx\<Class Name>.obj 1
When I checking the auto generated moc file, it had below errors. Please note that I have properly included 'QObject' in the header file.
#include "StdAfx.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'file_name.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Could you please help me to resolve this?