How to write and build a QT app on Ubuntu
$ sudo apt-get install libqt4-dev
$ mkdir qthello
$ cd qthello
$ cat > hello.cpp
#include
#includeint main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel hello("hello, world");
hello.show();
return app.exec();
}
$ qmake -project # makes a .pro file
$ qmake # makes a Makefile
$ make
$ ./qthello
More information here.
How to write and build a GTK+ app on Ubuntu
$ cat hello.c
#includeint main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *label;gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
label = gtk_label_new("hello, world");
gtk_container_add(GTK_CONTAINER(window), label);
gtk_widget_show(label);
gtk_widget_show(window);gtk_main();
return 0;
}
$ gcc -Wall -g hello.c -o hello `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
$ ./hello
pkg-config simply outputs the headers and libraries that need to be passed to gcc.
More information here.
Remove DOS line endings (^M) in Vim
The recommended way to remove DOS line endings (^M) in Vim is the following :s
command.
:%s/\r//
Source: http://vim.wikia.com/wiki/Change_end-of-line_format_for_dos-mac-unix
How I boosted my Vim
This is a clear and informative article about Vim customization:
Telling Maven Integration plugin for Eclipse where Maven installation directory is under Ubuntu
The Maven plugin for Eclipse by default uses an embedded Maven installation which is Maven 3.0. It turns out this has some incompatibilities with Maven 2.x and you are likely better off using Maven 2.x, which is fortunately still the version in the Ubuntu repository.
To specify which Maven installation to use in Eclipse, go to Window -> Preferences -> Maven -> Installations
. Click Add
. The default Maven installation directory for Ubuntu is /etc/share/maven2
. If you input the wrong directory you will get a "The selected directory is not a valid Maven directory" error message.