add a directory location for compilation

A

aaragon

Hi everyone, my question is probably trivial but I couldn't find a way
to do it. Is there a way to tell the compiler about a directory where
it has to look for some files? For example, I'm trying to use Qt to
design a graphic user interface and in my system the Qt files are
under /usr/include/Qt4 instead of /usr/include. I could easily change
the location in the produced header files but I think this is a brute
force approach and maybe adding another directory to the compiler is
something easy.

Thanks for your help.

 
I

Ian Collins

aaragon said:
Hi everyone, my question is probably trivial but I couldn't find a way
to do it. Is there a way to tell the compiler about a directory where
it has to look for some files? For example, I'm trying to use Qt to
design a graphic user interface and in my system the Qt files are
under /usr/include/Qt4 instead of /usr/include. I could easily change
the location in the produced header files but I think this is a brute
force approach and maybe adding another directory to the compiler is
something easy.
Consult your compiler's documentation, the common option for specifying
the include path is -I.
 
A

aaragon

Consult your compiler's documentation, the common option for specifying
the include path is -I.

Yes, I saw that but you have to change the Makefile to provide the
option with -I. However, I would like to do this permanently. Is there
any kind of environmental variable that can be changed with this
information?
 
J

Just me

Hi everyone, my question is probably trivial but I couldn't find a way
to do it. Is there a way to tell the compiler about a directory where it
has to look for some files? For example, I'm trying to use Qt to design
a graphic user interface and in my system the Qt files are under
/usr/include/Qt4 instead of /usr/include. I could easily change the
location in the produced header files but I think this is a brute force
approach and maybe adding another directory to the compiler is something
easy.

#include <> // includes headers from a directory listed with -i dir

#include "" // includes headers at an absolute or relative directory

For Qt4 use the qmake-qt4 project file (.pro) to modify the common macro
directory locations.


qmake-qt4 -project # creates a project file

vi *.pro # edits the project file that creates Makefile

qmake-qt4 # creates the Makefile

make # builds the app

by default the project file is the directory name followed by .pro
 
I

Ian Collins

aaragon said:
Yes, I saw that but you have to change the Makefile to provide the
option with -I. However, I would like to do this permanently. Is there
any kind of environmental variable that can be changed with this
information?
For that, you'll have to consult your compiler's documentation.
 
A

aaragon

#include <> // includes headers from a directory listed with -i dir

#include "" // includes headers at an absolute or relative directory

For Qt4 use the qmake-qt4 project file (.pro) to modify the common macro
directory locations.

qmake-qt4 -project # creates a project file

vi *.pro # edits the project file that creates Makefile

qmake-qt4 # creates the Makefile

make # builds the app

by default the project file is the directory name followed by .pro

Thank you so much, I just changed the .pro file and included the right
path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top