August 18, 2010

Dane Dane
Lab Rat
2 posts

undefined reference, trying to write a TCP/IP application

 

Hello out there.

To learn some small things about TCP/IP, I’m trying to write my own small “chat”.

It seems that there are no errors in my code, but the IDE still says: “undefined reference to ‘imp__ZN10QTcpSocketC1EP7QObject’.

So I might have forgott to link some libraries.

Could you tell me which those are?

Regards,

Dane

4 replies

August 18, 2010

Antonio Di Monaco Antonio Di Monaco
Lab Rat
116 posts

Well,

QT += network

in your .pro file is enough. You should post some more details.

Tony.

August 18, 2010

Dane Dane
Lab Rat
2 posts

Hi,

I think it’s still not working correctly.

My .pro file looks like this:

  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2010-08-02T14:56:46
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT       += core
  8.          += network
  9.  
  10. QT       -= gui
  11.  
  12. TARGET = SERVER_CLIENT
  13. CONFIG   += console
  14. CONFIG   -= app_bundle
  15.  
  16. TEMPLATE = app
  17.  
  18.  
  19. SOURCES += main.cpp \
  20.     client.cpp \
  21.     server.cpp \
  22.     packetwriter.cpp \
  23.     packetreader.cpp
  24.  
  25. HEADERS += \
  26.     client.h \
  27.     server.h \
  28.     packetwriter.h \
  29.     packetreader.h

The errors do still exist.

Regards,

Dane

August 18, 2010

Tobias Hunger Tobias Hunger
Mad Scientist
3155 posts

Try replacing lines 7 and 8 are not correct qmake syntax. Try

  1. QT += core network
instead.

August 18, 2010

Dane Dane
Lab Rat
2 posts

Hi,
It works now perfectly – Thanks a lot.

 
  ‹‹ [SOLVED] Android’s Gallery like widget in Qt      How to detect a specific running application/service from within my QtGui-based app? ››

You must log in to post a reply. Not a member yet? Register here!