[SOLVED] Qt SDK for Linux
-
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;
}@
-
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…).
-
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.
-
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
makehttp://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 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
makehttp://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.