linking - QT app

Discussion in 'C++' started by hasadh, Aug 4, 2004.

  1. hasadh

    hasadh Guest

    I am building an application over QT. I loaded my files to a VC++
    console application project.
    While trying to compile my classes, I got the following set for
    expcetion for all QT related classes. has anybody faced the same
    issue? Plz help me out


    QT version: 3.2.3
    OS : Windows 2000

    Exception trace,
    --------------------------------------------------------------
    Linking...
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    virtual bool __thiscall AddViewDialog::qt_property(int,int,class
    QVariant *)" (?qt_property@AddViewDialog@@UAE_NHHPAVQVariant@@@Z)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    virtual bool __thiscall AddViewDialog::qt_emit(int,struct QUObject *)"
    (?qt_emit@AddViewDialog@@UAE_NHPAUQUObject@@@Z)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    virtual bool __thiscall AddViewDialog::qt_invoke(int,struct QUObject
    *)" (?qt_invoke@AddViewDialog@@UAE_NHPAUQUObject@@@Z)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    virtual void * __thiscall AddViewDialog::qt_cast(char const *)"
    (?qt_cast@AddViewDialog@@UAEPAXPBD@Z)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    virtual char const * __thiscall AddViewDialog::className(void)const "
    (?className@AddViewDialog@@UBEPBDXZ)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    static class QString __cdecl AddViewDialog::tr(char const *,char
    const *)" (?tr@AddViewDialog@@SA?AVQString@@PBD0@Z)
    addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    static class QMetaObject * __cdecl
    AddViewDialog::staticMetaObject(void)"
    (?staticMetaObject@AddViewDialog@@SAPAVQMetaObject@@XZ)

    ....
    --------------------------------------------------------------

    thanks,
    prak
    hasadh, Aug 4, 2004
    #1
    1. Advertising

  2. hasadh wrote:
    > I am building an application over QT. I loaded my files to a VC++
    > console application project.
    > While trying to compile my classes, I got the following set for
    > expcetion for all QT related classes. has anybody faced the same
    > issue? Plz help me out


    Unresolved external errors usually appear due to one of two reasons:
    either you used a library function/object but didn't supply the
    library to the linker, or you declared a function yourself, used it,
    and never defined it.

    Which of the two situations is applicable in your case, I don't know.
    Try contacting Qt online forum (on TrollTech's web site).

    >
    >
    > QT version: 3.2.3
    > OS : Windows 2000
    >
    > Exception trace,
    > --------------------------------------------------------------
    > Linking...
    > addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    > virtual bool __thiscall AddViewDialog::qt_property(int,int,class
    > QVariant *)" (?qt_property@AddViewDialog@@UAE_NHHPAVQVariant@@@Z)

    [...]

    V
    Victor Bazarov, Aug 4, 2004
    #2
    1. Advertising

  3. hasadh

    hasadh Guest

    Thanks for your info. I have posted in QT forum.



    Victor Bazarov <> wrote in message news:<TW6Qc.437$09.us.to.verio.net>...
    > hasadh wrote:
    > > I am building an application over QT. I loaded my files to a VC++
    > > console application project.
    > > While trying to compile my classes, I got the following set for
    > > expcetion for all QT related classes. has anybody faced the same
    > > issue? Plz help me out

    >
    > Unresolved external errors usually appear due to one of two reasons:
    > either you used a library function/object but didn't supply the
    > library to the linker, or you declared a function yourself, used it,
    > and never defined it.
    >
    > Which of the two situations is applicable in your case, I don't know.
    > Try contacting Qt online forum (on TrollTech's web site).
    >
    > >
    > >
    > > QT version: 3.2.3
    > > OS : Windows 2000
    > >
    > > Exception trace,
    > > --------------------------------------------------------------
    > > Linking...
    > > addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    > > virtual bool __thiscall AddViewDialog::qt_property(int,int,class
    > > QVariant *)" (?qt_property@AddViewDialog@@UAE_NHHPAVQVariant@@@Z)

    > [...]
    >
    > V
    hasadh, Aug 5, 2004
    #3
  4. This looks like you have not properly preprocessed your
    C++ file, QT massages your raw C++ code and generates
    further C++ code through the "moc" compiler. Any class you
    derived from a QT-Object requires this step.
    You cannot just load a bunch of C++ files into VC++ and
    get it to work, you have to do something like:

    qmake -project
    qmake -tp vc ( generates a .dsp file for VC++)

    where qmake is run in the directory of your sources. The first
    step creates a QT-project, the second translate the ".pro" file
    into a VC++ project which you can run. You will have to do
    this every time you add new C++ files which define QT-widgets.
    Or, figure out how to setup VC++ to do this.

    dave

    "hasadh" <> wrote in message
    news:...
    > Thanks for your info. I have posted in QT forum.
    >
    >
    >
    > Victor Bazarov <> wrote in message

    news:<TW6Qc.437$09.us.to.verio.net>...
    > > hasadh wrote:
    > > > I am building an application over QT. I loaded my files to a VC++
    > > > console application project.
    > > > While trying to compile my classes, I got the following set for
    > > > expcetion for all QT related classes. has anybody faced the same
    > > > issue? Plz help me out

    > >
    > > Unresolved external errors usually appear due to one of two reasons:
    > > either you used a library function/object but didn't supply the
    > > library to the linker, or you declared a function yourself, used it,
    > > and never defined it.
    > >
    > > Which of the two situations is applicable in your case, I don't know.
    > > Try contacting Qt online forum (on TrollTech's web site).
    > >
    > > >
    > > >
    > > > QT version: 3.2.3
    > > > OS : Windows 2000
    > > >
    > > > Exception trace,
    > > > --------------------------------------------------------------
    > > > Linking...
    > > > addviewdialog.obj : error LNK2001: unresolved external symbol "public:
    > > > virtual bool __thiscall AddViewDialog::qt_property(int,int,class
    > > > QVariant *)" (?qt_property@AddViewDialog@@UAE_NHHPAVQVariant@@@Z)

    > > [...]
    > >
    > > V
    Dave Townsend, Aug 5, 2004
    #4
  5. hasadh

    scoutchen Guest

    In QT you have to expand macros (e.g. Q_OBJECT) before
    compiling/linking. Have a look at moc, the "meta object compiler".
    Infos@Google: "qt moc".
    scoutchen, Aug 5, 2004
    #5
  6. Dave Townsend wrote:
    > This looks like you have not properly preprocessed your
    > C++ file, QT massages your raw C++ code [...]


    (a) Please don't top-post
    (b) Please don't turn this C++ newsgroup into a Qt forum,
    they have those at their web site

    Thank you.

    V
    Victor Bazarov, Aug 5, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tom
    Replies:
    4
    Views:
    14,063
    jpowers5882
    Oct 24, 2008
  2. NGM
    Replies:
    0
    Views:
    2,280
  3. mimi

    win app and web app

    mimi, Jul 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    321
    Lucas Tam
    Jul 29, 2004
  4. Brian J. Ackermann

    Problem Linking Simple App

    Brian J. Ackermann, Jul 28, 2003, in forum: C++
    Replies:
    1
    Views:
    303
    Matthew Burgess
    Jul 28, 2003
  5. rama
    Replies:
    3
    Views:
    533
    Alex Sedow
    Sep 5, 2003
Loading...

Share This Page