add a directory location for compilation

Discussion in 'C++' started by aaragon, Aug 5, 2007.

  1. aaragon

    aaragon Guest

    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.

     
    aaragon, Aug 5, 2007
    #1
    1. Advertising

  2. aaragon

    Ian Collins Guest

    aaragon wrote:
    > 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.

    --
    Ian Collins.
     
    Ian Collins, Aug 5, 2007
    #2
    1. Advertising

  3. aaragon

    aaragon Guest

    On Aug 5, 5:13 pm, Ian Collins <> wrote:
    > aaragon wrote:
    > > 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.
    >
    > --
    > Ian Collins.


    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?
     
    aaragon, Aug 5, 2007
    #3
  4. aaragon

    Just me Guest

    On Sun, 05 Aug 2007 22:09:52 +0000, aaragon wrote:

    > 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
     
    Just me, Aug 5, 2007
    #4
  5. aaragon

    Ian Collins Guest

    aaragon wrote:
    > On Aug 5, 5:13 pm, Ian Collins <> wrote:
    >> aaragon wrote:
    >>> 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.
    >>

    >
    > 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.

    --
    Ian Collins.
     
    Ian Collins, Aug 5, 2007
    #5
  6. aaragon

    aaragon Guest

    On Aug 5, 5:40 pm, Just me <> wrote:
    > On Sun, 05 Aug 2007 22:09:52 +0000, aaragon wrote:
    > > 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


    Thank you so much, I just changed the .pro file and included the right
    path.
     
    aaragon, Aug 6, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luke Dalessandro
    Replies:
    0
    Views:
    616
    Luke Dalessandro
    Jan 15, 2006
  2. zxo102
    Replies:
    0
    Views:
    418
    zxo102
    Aug 1, 2006
  3. C__chp
    Replies:
    4
    Views:
    510
    Puppet_Sock
    Feb 15, 2008
  4. saiho.yuen
    Replies:
    3
    Views:
    437
    kaeli
    Sep 14, 2004
  5. John Bailo

    IE7 shows location even if location=no

    John Bailo, Jan 19, 2007, in forum: Javascript
    Replies:
    4
    Views:
    183
    OmegaJunior
    Mar 11, 2007
Loading...

Share This Page