Important: Please read the Qt Code of Conduct -

Why all the graphics libraries included for a console app

  • I used the fortune server example to create my first app, then removed all aspects of the gui. It's a console only app now.

    However, using ldd I see that my compiled app still depends on lots of libX11 etc. libraries (see below). Why? Is this left over from the fortune example - and if so how do I get rid of them?

    @ => (0x00007fff79f82000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655d339000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655cce0000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655c656000) => /lib64/ (0x000000372ee00000) => /lib64/ (0x0000003724600000) => /lib64/ (0x0000003732e00000) => /lib64/ (0x0000003724e00000) => /lib64/ (0x0000003726600000) => /lib64/ (0x0000003723e00000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655c227000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655bea0000) => /lib64/ (0x0000003724200000) => /lib64/ (0x000000372ae00000) => /lib64/ (0x0000003725200000) => /lib64/ (0x0000003725e00000)
    /lib64/ (0x0000003723a00000) => /lib64/ (0x0000003730a00000) => /lib64/ (0x0000003728e00000) => /lib64/ (0x000000372fe00000) => /lib64/ (0x0000003732600000) => /lib64/ (0x000000372be00000) => /lib64/ (0x0000003727e00000) => /lib64/ (0x000000372da00000) => /lib64/ (0x000000372d600000) => /lib64/ (0x0000003727a00000) => /lib64/ (0x0000003729e00000) => /lib64/ (0x0000003730600000) => /lib64/ (0x0000003725a00000) => /opt/Qt/5.1.1/gcc_64/lib/ (0x00007f655a751000) => /lib64/ (0x0000003728200000) => /lib64/ (0x0000003725600000)@

  • This is just a guess since I can't see your source code. Probably you are still using "QApplication" header instead of "QCoreApplication".

    Maybe you can post your code here

  • Moderators

    Did you remove also QT += widgets etc. from your .pro file?

  • I changed QApplication to QCoreApplication, and removed widgets from my .pro file (only QT += network left). My Code is too big to post now...but are there other things I can look for?

  • Moderators

    Yes, you should also add CONFIG += console. Take a look "here": to find out about other qmake options available.

    Anyway, the easiest way is to create an empty console app and take a look at the generated config.

  • I tried adding CONFIG+=console to my .pro file, but the executable still has all the x11 libraries....

  • I took your advice and create a new console app, and found a few more settings

    CONFIG -=app_bundle
    QT -=gui

    and once I added those to my .pro it now looks right. Thanks!

Log in to reply