Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sorry, total Qt newbe question...
Qt 6.11 is out! See what's new in the release blog

Sorry, total Qt newbe question...

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 Offline
    1 Offline
    10Degree
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SimonL
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chuck Gao
        wrote on last edited by
        #3

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

        Chuck

        1 Reply Last reply
        0
        • 1 Offline
          1 Offline
          10Degree
          wrote on last edited by
          #4

          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 (http://doc.qt.nokia.com/4.7-snapshot/qmake-variable-reference.html) 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?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chuck Gao
            wrote on last edited by
            #5

            Look at "Advanced qmake" :)

            Chuck

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved