PDA

View Full Version : Include path question



MarkoSan
28th September 2009, 13:08
Hi to all!

In my project, I have following directory structure:
Folder PATH listing
Volume serial number is 0000-0000
C:.
│ PresernMkI.pro
│ PresernMkI.pro.user

├───includes
│ mainwindow.h

├───libs
├───src
│ main.cpp
│ mainwindow.cpp

└───ui

Now, in file mainwindow.cpp, how do i include mainwindow.h? Code
#include "../include/mainwindow.h" does not work since I get compiler errors regarding missing mainwindow.h file. Please help me!

Sincerely,
Marko

scascio
28th September 2009, 13:15
You can use makefile variables in your .pro to specifiy your include path.
INCLUDEPATH may be useful for you.

Others are described there :
http://qt.nokia.com/doc/4.5/qmake-variable-reference.html

Then you just need to include headers

#include "mainwindow.h"

caduel
28th September 2009, 13:18
And your directory is named includes not include (as you have written in your #include).

Using ".." in #include should work, otherwise.
(Use it only in headers that are private or for .cpp files, though.)

MarkoSan
28th September 2009, 13:21
You can use makefile variables in your .pro to specifiy your include path.
INCLUDEPATH may be useful for you.

Others are described there :
http://qt.nokia.com/doc/4.5/qmake-variable-reference.html

Then you just need to include headers

#include "mainwindow.h"

Wow, thank a lot, man!!!! It works now ...