Results 1 to 3 of 3

Thread: Qt3: How to include/link 3rd party libraries without moc? [solved]

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Qt3: How to include/link 3rd party libraries without moc? [solved]

    I just started trying to write a little tool that needs to catch global shortcuts. As far as I understood this should be possible using kdelibs (kaccel.h). I include kaccel.h and append /usr/kde/3.5/include/ to INCLUDEPATH in my project file. Then I run qmake and make and come up with the following error:

    i686-pc-linux-gnu-g++ -c -pipe -Wall -W -O2 -march=athlon-xp -pipe -fno-strict-aliasing -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT -I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/kde/3.5/include -I/usr/qt/3/include -o main.o main.cpp
    main.cpp:3: warning: unused parameter 'parent'
    main.cpp:3: warning: unused parameter 'name'
    /usr/qt/3/bin/moc main.h -o moc_main.cpp
    i686-pc-linux-gnu-g++ -c -pipe -Wall -W -O2 -march=athlon-xp -pipe -fno-strict-aliasing -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT -I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/kde/3.5/include -I/usr/qt/3/include -o moc_main.o moc_main.cpp
    /usr/qt/3/bin/moc /usr/kde/3.5/include/kaccel.h -o /usr/kde/3.5/include/moc_kaccel.cpp
    moc: Cannot create /usr/kde/3.5/include/moc_kaccel.cpp
    make: *** [/usr/kde/3.5/include/moc_kaccel.cpp] Error 1


    Seems like moc tries to run on kdelibs. kaccel.h unfortunately uses the Q_OBJECT macro, so moc is correct on its decision. However, I have that library already compiled and don't need it a second time. How do I tell qmake/make not to compile kaccel again? Or at least to compile it somewhere else instead of /usr/kde/... ? Does it have to be recompiled (I don't think so)?

    I didn't code in C++/Qt for 1 1/2 year and never before and Google doesn't get me any answer to my problem. Could someone please give me a short example on how to include 3rd party libraries (doesn't need to be KDE). I assume it's rather simple to solve?

    If it matters: I use GCC 4.1.2, Qt 3.3.8 and KDE 3.5.5.

    Thanks in advance!
    Last edited by EnQ; 30th September 2007 at 22:24.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt3: How to include/link 3rd party libraries without moc? (simple newbie question

    Are you sure you didn't add kaccel.h to HEADERS by accident? Don't forget to add KDE libraries to LIBS variable too.

  3. The following user says thank you to jacek for this useful post:

    EnQ (30th September 2007)

  4. #3
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Qt3: How to include/link 3rd party libraries without moc? (simple newbie question

    Not me, but qmake -project. Thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.