Important: Please read the Qt Code of Conduct -

Can't "make" the out-of-box Shared Memory Example

  • Howdy! This is my first post. I'm trying to learn about Qt, and specifically about using the Shared Memory class QSharedMemory.

    To start out, I've been teaching myself with the C++ GUI Programming with Qt 4 book ( and have succesfully gotten the Hello World & other basic programs to run in Qt Creator.

    Now... I'm trying to follow the instructions on this page:

    When I run make in my Linux console, like the website says in the second paragraph, I have the following error:

    _.obj/release-shared-emb-x86/moc_dialog.o:(.rodata._ZTV6Dialog[ZTV6Dialog]+0x160): undefined reference to `QWidget::qwsEvent(QWSEvent*)'

    I feel I should provide some version numbers to the community - what would be helpful and how can I get them? (note that I'm running Ubuntu, and that my SHM example code is from the qt-everywhere-opensource-src-4.8.5 directory I downloaded last week).

    Regards, Chris

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    There's one thing puzzling me, you seem to have an embedded version of Qt for x86. Why not use the system provided version ?

  • Thanks SGaist!

    Interesting - that definitely was not what I meant to do.

    Do you think I need to start over with a new download?

  • Lifetime Qt Champion

    Since you're using Ubuntu you can just install the Qt dev tools and libraries. No need to build your own

  • Excellent. Unfortunately, it seems I already had that installed:

    J@UBUNTU:~$ sudo apt-get install qt4-dev-tools
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    qt4-dev-tools is already the newest version.

    Could I have an incorrect setting/default/etc somewhere?

  • Lifetime Qt Champion

    Then ensure that you are using your system's qmake when configuring the project

  • So, unfortunately I am still confused here.

    [quote author="SGaist" date="1391641485"]Then ensure that you are using your system's qmake when configuring the project[/quote]

    1. To do this, do I need to edit one of qmake's files?

    2. is the following warning typical? ....

    • I tried to run qmake for the "shared memory" example program, since I read ( that qmake will generate the project's Makefile.

    • But, running qmake returns this:

    • Project WARNING: qmake spec does not announce the compiler family. Guessed gcc.

    I appreciate your help to teach me, as I don't have much experience in this area.

  • Lifetime Qt Champion

    You must have something mixed.

    To ensure you are using your system qmake call it with the absolute path. You might be having another version appearing first that is wrecking havoc.

  • I found this:

    cj@UBUNTU:~/Documents$ which qmake

    So I've updated to the latest (5.2.1) of Qt.

    Now, I'm following the instructions from here () and I didn't have the same issue/warning when running qmake. When I run make I get this, which seems to be better than before: ...

    cj@UBUNTU:~/qt/QtHelloWorld$ make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt5.2.1/5.2.1/gcc_64/mkspecs/linux-g++ -I. -I. -I/opt/Qt5.2.1/5.2.1/gcc_64/include -I/opt/Qt5.2.1/5.2.1/gcc_64/include/QtWidgets -I/opt/Qt5.2.1/5.2.1/gcc_64/include/QtGui -I/opt/Qt5.2.1/5.2.1/gcc_64/include/QtCore -I. -o main.o main.cpp
    g++ -Wl,-O1 -Wl,-rpath,/opt/Qt5.2.1/5.2.1/gcc_64 -Wl,-rpath,/opt/Qt5.2.1/5.2.1/gcc_64/lib -o QtHelloWorld main.o -L/opt/Qt5.2.1/5.2.1/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread

  • Lifetime Qt Champion

    Indeed it's building

    Still, I'm surprised that it's Qt 5's qmake that is found first and not the system version.

Log in to reply