compile on Linux, /home/suse132/Qt5.4.0/5.4/gcc_64 is the QTDIR g++ helloqt.cpp -fPIE -std=c++0x -I"/home/suse132/Qt5.4.0/5.4/gcc_64/include" -L"/home/suse132/Qt5.4.0/5.4/gcc_64/lib" -lQt5Core -lQt5Gui -lQt5Widgets -o helloqt or use two commands instead: g++ -c -fPIE -std=c++0x helloqt.cpp -I"/home/suse132/Qt5.4.0/5.4/gcc_64/include" -o helloqt.o g++ helloqt.o -L"/home/suse132/Qt5.4.0/5.4/gcc_64/lib" -lQt5Core -lQt5Gui -lQt5Widgets -o helloqt