Qt and environment variables passed to main

来源:互联网 发布:php源码 编辑:程序博客网 时间:2024/06/07 05:25

On ubuntu I can use the environment variables passed to main as the following, but it does not work on Windows since QT does not pass env in qtmain_win.cpp.

 

int main(int argc, char *argv[], char* env[])

{

 

    //C:/Qt/4.6.3/src/winmain/qtmain_win.cpp does not provide env argument

#ifndef _MSC_VER

    while(env[i])

    {

        BOOST_LOG_TRIVIAL(info) << env[i] ;

        environment_variable_list.append(env[i]);

        i++;

    }

#endif

 

}

Actually QProcessEnvironment should be used for this purpose. 

 

An interesting topic: Building static Qt on Windows with MSVC

原创粉丝点击