Important: Please read the Qt Code of Conduct -

Environment Variables

  • I've been having fun. I'm going through someone else's code. I keep trying to compile their code, and the error I get is something about an environment variable not found. It just names the variable, and when I do a search for it in the PRO and source files, I can't find it. Can anyone shed any light on this for me?


  • Maybe your project is incomplete and developers used some script to compile it.

  • That very possibly true. However, Qt is what is asking for the environmental variable, and I can't figure out how it knows it needs that variable. I can't find the variable through a search, but it knows it needs one.

    What tells Qt to look for a environmental variable? I've poke around with the code but can't figure out how Qt knows it needs it.

  • Could you at least provide us the name of that variable?

  • Yes, You need tell us what the variable's name is. and you can try search in Makefile for it

    Usually, DEFINES += in PRO file ....

  • Sorry, I'm wrong. Environment Variable usually appears in make script

  • Greetings,

    -I started an old post, and I didn't want to recycle it as I have learn more about the problem.-

    I have a bunch of old source files I am looking through with little documentation. When I try to compile part of the code it gives me "MY_AAB_DIRECTORY". That doesn't look like a windows variable, it looks like a predefine variable in project files. However, I cannot locate that variable in the source code at all.

    I even opened up a project file in the source code. This project file had no other associated files with it for some reason, and I deleted the two lines that was in it. However when I ran qmake, I got the error about not finding the environment variable, and clearly this file was no associated with anything else, it was virtually a blank file. I even clean and clear everything before I ran qmake.

    What I have notice is if I drag a folder out of the source directory, I just unzipped the source files into an empty directory, onto the desktop I don't get the error about not finding the environment variable.

    So my question is how is Qt knowing it needs this variable? Obviously Qt is reading in some other directory but I don't know how it knows. I done everything I can think off, and still can't figure out where it is at.


  • The moderators think it is the same topic, and should thus be continued in the same forum thread, hence the merge. If the 'old topic' would have been months old or even older, perhaps you would have been right to start a new one. In this case, it is only a day old. That is not an 'old topic', it is just starting a second one on the same issue.

    Frankly, I find it a bit disrespectful to the people who have responded in your 'old' post, who you did not seem fit to reply to. If you did not reply earlier, how is that stimulating for these people to now try to help you again?

  • Just do a

    find . -type f -print0 | xargs -0 grep MY_AAB_DIRECTORY

    in the source directory. It will show you all the occurrences of the string MY_AAB_DIRECTORY, if any. This will work on any Unix/Linux/Mac and with MinGW on Windows.

  • I just hit CTRL+SHIFT+F in Qt Creator to do the same :-)

  • [quote author="Andre" date="1330597667"]I just hit CTRL+SHIFT+F in Qt Creator to do the same :-)[/quote]

    That's only half the fun :)

  • I had already did the CTRL+SHIFT+F in Qt Creator, before I posted.

  • Sorry, I have not a single clue, what's going wrong here. The description is too vague and without looking at the actual project, I doubt that we can get any further here.

  • Let me give you a clearer picture:

    I have one project with just one file in it, the project file itself. There are only two lines in this project file, and I delete them. (Not: these two lines did not contain anything about the environment variable) I save the changes, I then clean all. There is now nothing in the project file and only this project file is loaded. I either do a qmake or build all, I get that error about my environmental variable not being found, on an empty project file.

    So if you imagine a blank and empty project giving me MY_AAB_DIRECTORY environment variable, you have an accurate picture.


  • How is an empty project file supposed to do any reasonable work?

  • That not my point. Your concern was you needed to see the project, and I'm pointing out there's nothing to see, literally. Qmake shouldn't give errors on empty project files about environment variables. I gave it a try Qmake does nothing on an empty file. I can also reproduce the same errors by deleting the entire contents of another project in the source folder.

    I should of mention earlier, when I get the error and click on it, it says "file not found". So its looking for something that's not there, and I don't know why its looking for it in the first place.


  • qmake moans on an empty - because it wants to link something (the app name is based on some default logic if there's no TARGET explicitly set). So no, qmake is not quiet on an empty project file.

    So, maybe you want to post the complete build log of that empty project. I doubt that anyone can imagine what's going on here.

  • Where's this build file?

Log in to reply