Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED] Qt SDK for Linux
QtWS25 Last Chance

[SOLVED] Qt SDK for Linux

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 3 Posters 2.2k Views
  • 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.
  • Z Offline
    Z Offline
    Zerby
    wrote on last edited by
    #1

    Hello,

    I've been using Qt for almost a year now, on Windows. I really like it, signals and slots give so much and the ease of creating UI is wonderful.

    But, as a next step for my project, I need to create a client / server connection using sockets. Client is a Windows machine, no problems there, but the server is a Linux. Now, I'm fairly new to Linux all together. But, all I need to get started, is to install the Qt SDK to my Linux machine!

    Now, the server is an virtual Linux machine, running Debian. X -server is not in use, I purely use it from the terminal via SSH. I know Qt isn't the best library to use here, because most of Qt's advantages lie in the UI department - but as I said, I've grown to use signals and slots, and I want them for my server app aswell! :)

    I've tried every guide I've found, but every Qt SDK install attempt fails on "X -server cannot be reached" or something like that. The thing is, all I want is the core of Qt, I've no intent to create any graphical UI for my server app. Can anyone provide my with a step by step guide, how can I use the Qt library on Linux, so I can compile something as simple as:

    @#include <iostream>
    #include <string>
    #include <QStringList>

    int main (int argc, char *argv[])
    {
    QStringList list;
    list.append("Line 1");
    list.append("Line 2");
    list.append("Line 3");

    for (int i = 0; i < list.size(); i++)
    {
    std::cout << list.at(i).toStdString() << std::endl;
    }

    return 0;

    }@

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Qt's also strong for command line application/server etc… GUI might be one of the main feature but that's certainly not the only one :)

      Since you're on Debian you can simply install the Qt dev packages using apt-get and select only the modules you need (core/network/sql etc…).

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zerby
        wrote on last edited by
        #3

        Ah, of course! I actually have qt4 library installed from my previous attempts. But, I don't really know how to use it (as I said, I'm new to Linux ;))

        So, I have and example .cpp like in my opening post. I then run:

        @
        g++ -c -I /usr/include/qt4 example.cpp@

        And I get and error:

        qttest.cpp:3:23: fatal error: QStringList: No such file or directory
        compilation terminated.

        I guess I have to link to the library itself or something? How do I do that?

        I also tried using qmake directly, I got it compiled okay but running it gave huge load of errors.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hackbinary
          wrote on last edited by
          #4

          Hello,

          I have just run and tested your code, but I used qmake; so you need to make sure that you have qmake instaled.

          Jan Bodnay on his website, zetcode.com, outlines how to do this.

          In your linux console, in your project directory, type:

          qmake -project
          qmake
          make

          http://zetcode.com/gui/qt4/introduction/

          Once you have run the qmake commands in your test project directory, you can then inspect qmake; I personally think it would be too complicated to compile with g++ directly from the commandline.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Additionally, since you won't use any GUI classes, you have to modify the pro file with something like that:

            @QT = core@

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              Zerby
              wrote on last edited by
              #6

              [quote author="hackbinary" date="1386528509"]Hello,

              I have just run and tested your code, but I used qmake; so you need to make sure that you have qmake instaled.

              Jan Bodnay on his website, zetcode.com, outlines how to do this.

              In your linux console, in your project directory, type:

              qmake -project
              qmake
              make

              http://zetcode.com/gui/qt4/introduction/

              Once you have run the qmake commands in your test project directory, you can then inspect qmake; I personally think it would be too complicated to compile with g++ directly from the commandline.[/quote]

              Thank you very much! I did not do the final call to "make" with my own testings, now I got in compiled and it ran fine!

              Thank you also SGaist for your help, I did also modify the .pro file before compiling.

              This issue is now solved.

              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