Results 1 to 5 of 5

Thread: Paths & enviroment settings

  1. #1
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Paths & enviroment settings

    Hi all,

    I develop on 4 different computers and my work files start at different paths on each box but follow the same sub directory structure from then on. Due to the piles of programs I keep adding I need some sort of variable that can be set once that points to my work directories.

    This is what I have tried at the moment

    (at a command prompt)

    qmake -set MY_DIR C:\Documents and Settings\User3\My Documents\Qt\Components

    (where the path is different for each machine, but only has to be done once on each)

    I can then use $$[MY_DIR] in any .pro files to substitute the path for that machine
    (note, due to the spaces in the path I have to use another reference in the .pro files like this: MYDIR = "$$[MY_DIR]" and then use $$MYDIR instead)

    This still leaves a problem in the program .cpp and .h files since the path is not recognised by the #include <program.h> lines and causes the syntax checker and code completer to fail (setting INCLUDEPATH += $$MYDIR does not help)

    Programs will compile with the above setup but I really want the syntax checker and code completer to work.

    Can anybody point out the setting I need to do this ?

    SteveH

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Paths & enviroment settings

    It sounds to me that [WIKI]Current working directory[/WIKI] could be of interest (then you have to put the exe "relative" to the working documents). Or simple hard code some paths or routine on where to look for and if they fail to locate the documents provide a settings dialog where one can define the path (QSettings).

  3. #3
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paths & enviroment settings

    Why not setup the environment and launch Creator from a batch file? Take a look at LIB and INCLUDE (if you use the visual studio compiler). In Creator goto Projects->Build Settings->Build Environment->Details to see what I mean.

  4. #4
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Paths & enviroment settings

    Thanks Lykurg and Timoteo for your replies.

    The problem is not so much as a run time problem as a compile problem. I tend to copy a program directory directly from one machine to another as I move around and would prefere not to use absolute paths to all my personal classes/widgets/components that need to be compiled into a particular project as I would have to change large number of paths in various places after each move. Having a MY_DIR variable on each machine pointing to the root of my work directories solves that.

    There is obviously a set of environment variables on each build of Qt that allow #include <foo.h> to work by supplying the root path for that installation. I thought that setting a persistent variable in qmake would supply mine. I know that I can use $$PWD in the .pro file and qgetenv() in the program file to supply run time variables.

    My setup is Windows with latest version Qt and Creator recompiled for mingw so I can get my designer plugins to work.


    Added after 46 minutes:


    Update.

    Further attempts seems to point to the spaces in the root pathname being the problem with INCLUDEPATH (but not with SOURCES and HEADERS which work ok).

    If I use the actual pathname in quotes, ie "c:\my\path\to\work\files", then everything works ok but using "$$[MY_DIR]" fails (but shows exactly the same pathname using message($$INCLUDEPATH) ) . I've tried $$quote($$[MY_DIR]) but that does not work either.
    Last edited by SteveH; 22nd November 2010 at 22:53.

  5. #5
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Paths & enviroment settings

    Further update

    Ok - after further research and experimenting I conclude that the problem is well known and due to the INCLUDEPATH statement - it will only accept spaces in quoted ("" or $$quote()) text that is directly inputted on that line after the command word. NO type of indirection through variables seems to work even though they display the same path text using 'message()'. All other command settings in qmake seem to accept indirection of paths with spaces.

    DAMM & BUGGERIT MICROSOFT - do you hate us that much ! (I'll reserve judgment on qmake as that at least has the power to change)

    Simple solution is to move my work files to a path from the root with no spaces (c:\Qt\MyWork) but it needs two extra clicks in explorer each time I look there !

    SteveH

Similar Threads

  1. Config QT Enviroment For Embedded ?
    By Thành Viên Mới in forum Newbie
    Replies: 1
    Last Post: 4th November 2010, 09:42
  2. Making MySQL plugin work on a windows x86 enviroment
    By Baasie in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd September 2009, 15:15
  3. How to include ActiveQt in my Qt development enviroment??
    By Cantora in forum Installation and Deployment
    Replies: 0
    Last Post: 10th June 2009, 09:57
  4. include paths
    By altec in forum Installation and Deployment
    Replies: 0
    Last Post: 8th August 2008, 11:59
  5. How to set paths?
    By hoborg in forum Installation and Deployment
    Replies: 11
    Last Post: 24th February 2006, 19:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.