Qt should solve this for you.

Where do you call getenv()?