Linux GUI Lib + Compiling multiple files

Hello,

I recently started programming on Linux and I had enough of console, so I'd like to start doing some apps with GUI - I'm running Raspbian - Raspberry version of Debian, and have no idea how to start doing GUI applications - under windows I've been using Win32API for years...

I'd also like to know how I can compile multiple files (headers and source files) under one application, for example under windows I could have VisualStudio project with 5 files:

myclass1.h
myclass1.cpp
myclass2.h
myclass2.cpp
myprogram.cpp

and it would compile all into 1 program, so how do I do the same under Linux, when I want to include myclass 1 and 2 in myprogram ?

I'm using g++ for compiling

Thanks!
Try using QtCreator. It is an IDE which handles multiple files like you had with Visual Studio. It also provides a very good library (Qt) for GUIs. It's a bit more than Win32 (it's C++, not C), so if you have experience with MFC, you'll probably fit in.
I've read some not so good reviews on QT and I have few libs that I want to try (wxWidget, JUCE, gtkmm3) so I'd need something else, that can be used as visual studio where I can just program without being forced to use specific framework (if that's the case with QtCreator, which I think it is) or just a commands for terminal that will somehow link those files - me going from Win to Linux doesn't necessarily mean i want to do everything the same way I used to do
Guess what? WxWidget is an extension to Qt!

Also, Qt can be installed in Visual studio if you are in windows and don't want to use QtCreator.

Also, you're in the unix programming forum and Visual Studio is Win-only.

Also, if you want a graphics library but don't want to use a framework, then you can't really use a library. Qt is considered a framework only because it's such an extensive library.

Also, Qt is quite a professional framework, providing the basis for the KDE desktop envliornment, VLC media player, and something I use at work too.

But I'll step back. If you're getting yourself introduced to linux then you need to be able to split everything into smaller parts (building blocks). Those parts are your text-editor, compiler/linker, and libraries. The text editor could be vim, QtCreator, gedit, builder, emacs, eclipse. The compiler/linker will probably be gcc (awesome). The libraries could be gtk (gnome-specific), Qt (cross-platform), Win32 (windows), X11 (linux lower-level than gtk), OpenGL (3d graphics card direct access), SFML (simple fast multimedia library), SDK. You're not going to find a single executable for download to provide you with everything you want. Yoiu'll need to put it all togeather. If you have questions about specific components, we're happy to help here.

closed account (z05DSL3A)
Qt is fantastic...until you find the bit you really want is not available under the open source licence, then it is fantastic and stupidly expensive (for a small shop).
@Stewbond

I appreciate your effort, but I can't count how many times I just face-palmed myself while reading that prepared tech support answer...
$ g++ -c *.cpp #compiling the sources
$ g++ *.o -o program.bin #linking them to create an executable

To automatize the process and avoid unnecessaries compilations
https://www.gnu.org/software/make/manual/make.html
or use an IDE like CodeBlocks or ZinjaI.

To build against libraries use pkg-config


Also, you may consider tcl/tk for GUI
Last edited on
http://lazyfoo.net/SDL_tutorials/ - step by step tutorial instructions for SDL 1.3.
Rasbian does not yet have SDL 2 in the repositories, and may never do so. SDL 1.3 does not seem to excel in any one area, it's a bit limmited from what I've seen so far, but it is easy to use and quick to learn. If you have that much experience in WinAPI, you'll grow tired of SDL after about two weeks. I think it's only good for 2d games, but can support openGL, is a very easy starting point in GUI, cross-platform, and versatile in it's own ways.
Following the tutorials above you'll have a window with a blitted image in about 5-10 minutes of starting out.


http://www.ics.com/files/docs/Qt_LGPL.pdf - (LGPL is an option in QT 4.5 and up) does anyone know if this is still in effect? I was avoiding QT due to outdated information that said it was not free to distribute...


Finally, you're on a raspbian, so you can check how popular a library is by using the command
apt-cache rdepends libraryname which will bring up a list of all programs in the repositories that use that library as a dependency.
Or use apt-cache depends programname to see the list of libraries that a certain program is using.
Last edited on
Actually, I tried out a little of Qt today, and it is also very nice for beginning gui. Programming-wise it feels very similar to GTK2.0, which is the GTK version that users seem to have liked most (many were upset when GTK 3.0 came out).
There are also a lot of pdf's available if you search google with: Qt4 filetype: pdf

To build a simple Qt program type: g++ main.cpp class1.cpp nextClass.cpp `pkg-config --libs --cflags QtGui` Just notice that pkg-config is surrounded by reverse apostrophes which are usually found under the escape key. When you use that in the command line it means to use the output of the internal command as part of the input of the main command.


The best I can say is that you should try out a new library every week or two until you find the one that fits you and what you need. Many have components that you can decide to mix and match later on.
Last edited on
Topic archived. No new replies allowed.