Visual C++ compiler - moc generation
Hi everyone.
I'm using QT Creator and the microsoft compiler in a project. However, I'm getting now some compiler errors (linker) due to some classes (Q_OBJECT) that I've added. I believe it is happening because there are .mocs to be generated and I believe the compiler is not generating them. Here are the error messares:
Code:
HpQCarouselEnvelope.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Hp::Psg::HpQCarouselEnvelope::metaObject(void)const " (?metaObject@HpQCarouselEnvelope@Psg@Hp@@UBEPBUQMetaObject@@XZ)
HpQCarouselEnvelope.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Hp::Psg::HpQCarouselEnvelope::qt_metacast(char const *)" (?qt_metacast@HpQCarouselEnvelope@Psg@Hp@@UAEPAXPBD@Z)
HpQCarouselEnvelope.
obj : error LNK2001
: unresolved external symbol
"public: virtual int __thiscall Hp::Psg::HpQCarouselEnvelope::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@HpQCarouselEnvelope@Psg@Hp@@UAEHW4Call@
QMetaObject@@HPAPAX@Z
)
command failed with exit code 1120
jom 0.8.3 - empower your cores
command failed with exit code 2
The process "C:/Qt/qtcreator-1.3.85/bin/jom.exe" exited with code %2.
Error while building project Apollo (target: Desktop)
When executing build step 'Make'
Is there anyone here that could help me, maybe a link teaching me how to force moc generation...
Re: Visual C++ compiler - moc generation
Do you use the Qt VS addin? That normally handles all the MOC stuff for you.
Re: Visual C++ compiler - moc generation
Hi, you can add the moc call manually:
right-click the header of you class -> Properties -> Custom Build Step; add your moc call. Don't forget to add the generated moc_<classname>.cpp to your project.
But sometimes it helps to remove the class from the project once and add it again, the VS Addin will add the necessary steps for you.
Ginsengelf
Re: Visual C++ compiler - moc generation
I also want to the answerï¼Please help me!!!