PDA

View Full Version : What's the difference beetwem those two notations in including Qt's header files?



code_err
3rd January 2012, 20:08
I see in QtCreator and documentation this way:
#include <QtGui/QWidget>

Why not just
#include <QWidget>

I do not remeber if it is related with c++ syntax... maybe namespaces or something?

ChrisW67
3rd January 2012, 20:55
There's no difference from a user perspective except that one is shorter to type. They both identify the same file called QWidget. On my Linux machine qmake supplements the compiler include path with:

g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED \
-I/usr/share/qt4/mkspecs/linux-g++ \
-I. \
-I/usr/include/qt4/QtCore \
-I/usr/include/qt4/QtGui \
-I/usr/include/qt4 \
-I. -I. -o main.o main.cpp

for a simple GUI program. The first include style will find the file via "/usr/include/qt4", the second style via "/usr/include/qt4/QtGui".

code_err
4th January 2012, 13:26
Thanks, you resolved my doubts.