Important: Please read the Qt Code of Conduct -

Eclipse and qmake

  • This is my first message on this forum… so hello at all..

    I have to make c++ project with Eclipse IDE and using QT library… and I want to integrate QT library…
    So I have downloaded Eclipse and QT version 5.1.0, included the library and all work…My problem born when I try to integrate qmake in eclipse for using moc compiler… I followed this procedure but doesn’t work…

    Could someone help me?

    Sorry. I try to explain better the problem... After installing eclipse with O.S. windows I have created a new project:

    1. File->new->c++ Project (inserted the project name) and selected MinGW GCC as toolchains and debug and release as configurations

    2)Project->Properties-> C/C++ Build->Settings->GCC C++ Compiler->Includes .. I included the path of may Qt library

    3)Project->Properties-> C/C++ Build->Settings->MinGW C++ Linker-> LIbraries I included the link to the libraries.

    4)I have created my file project called main.cpp and the header and cpp for my class (testclass1.h testclass1.cpp)

    1. My class is a deriverd class of QObject and since I have to use signal and slot I need of Q_OBJECT macro.

    2. Run->External ToolsConfigrations I created two new Programs.

    .Location .../bin/qmake

    .Location .../bin/assistant

    7)Created a new target in my "Make target" Target Name: qmake Make Target: Build Command: qmake

    Target Name: all
    Make Target: all
    Build Command: default (make) 
    1. when I run qmake I have this error: undefined reference to `vtable for testclass1..I thinks that this depends on the macro Q_OBJECT.. I expect that running qmake the moc compiler is called so I should have in testclass1.cpp the macro Q_OBJECT "expanded"..

    At the moment I solved the problem in this manner(from command line I called): qmake -project (create qmake (create a makefile) mingw32-make that create moc_testclass1.cpp... So I copy the content of moc_testclass1.cpp in my testclass1... and I can build the project and all work. But this is not and automated way..

    I hope to be more clear in my description. Thanks for your help.

Log in to reply