Qt metaObject linker problem

后端 未结 8 572
猫巷女王i
猫巷女王i 2020-12-30 01:03

After integrating Qt with Vs and trying to compile .pro file I\'m getting following errors:

Error   9   error LNK2001: unresolved external symbol \"public         


        
8条回答
  •  佛祖请我去吃肉
    2020-12-30 01:15

    I'm currently working with VS 2013 with QT 5.4 add-in. Building projects with the add-in makes it easier as the moc'ing is automatically handled. To prevent linker error problems with the Qt metaObject issues:

    1. Comment out all instances of Q_OBJECT in all header files that contain it in the class declarations.

    2. Build the solution

    3. Uncomment all instances of the Q_OBJECT in the header files.

    4. Rebuild the solution. This is where the all the all the header and cpp files are re-compiled with the moc'ing automatically done. The linker errors are in turn, taken care of.

提交回复
热议问题