Sorry, total Qt newbe question...

  • I am sorry, I am sure this is really a dumb/dorky question but can someone explain to me why this code does not build? I get:

    undefined reference to `_imp___ZN10QUdpSocketC1EP7QObject'

    on the line that declares the QUdpSocket. This is a command line application. I must not understand some basic -QT- Qt concept here...

    #include <QtCore/QCoreApplication>
    #include <QtNetwork/QUdpSocket>

    int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);
    QUdpSocket udp;
    return a.exec();
    EDIT: please use @-tags for code highlighting, Gerolf
    Edit 2: the toolkit we're working with is called Qt, not QT; Andre

  • you probably need to add QT += network to your .pro file to include the network libs

  • A general error here:)
    Qt means what we use, and QT means QuickTime. Make sure you use the correct one :)

  • Thanks for the help - that worked great! I am assuming that adding this reference to the .pro file is similar to adding references to libraries in Visual Studio (as in VB or C#, etc)? I found this reference ( that explains the use of the "QT" variable that I edited in the .pro file. Is anyone aware of any other documentation that explains when, or under what circumstances you would need to edit the .pro file?

  • Look at "Advanced qmake" :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.