set up PGI Community Edition on windows 7


I have a problem after setting up PGI Community Edition on windows 7.

When I use

pgfortran hello.cuf

The code is compiled successfully, however linked error, which shows as below,

libpgc.lib <pgstfinit.obj> : error LNK2019: unresolved external symbol -enviiron, this symbol is used in _io_environ

would you mind tell me how to fix this problem?
Thank you!

Hi cofludy,

You most likely didn’t co-install the Microsoft Windows SDK hence are missing the MS the runtime libraries. Please see the following web page detailing the co-installation requirements:

Hope this helps,

Hi mkcolg,

Thanks for your help.

Actually I have installed the Microsoft windows SDK and Visual Studio 2015.

But in a different sequence with the office install guidance. I installed the SDK after the visual studio 2015 with Visual C++ and Cuda C. PGI is the last one.

Does it matter? Should I re-install them all?

your help is important for me. thank you.

So long as PGI is installed last, it shouldn’t matter, but it’s possible that you missed a step such as installing MS C++. You may try re-installing, following the steps outlined on our web page, and see if it fixes the issue.

The other place I’ve seen this error is when mismatching compiling with and without -Mdll since the “__environ” symbol only lives in the MS static C runtime library (libcmt.lib). Or you can try adding “-Mdll” or “-Bdynamic” to your compiler options to use the DLL C runtime instead.

Note that I’m assuming that “-enviiron” is a typo and should be “__environ”. If the error really does show “-enviiron”, then something else is going on since I’ve never seen this symbol name before and highly doubt a symbol name would start with a “-”.


“-Mdll” or “-Bdynamic” compiler options really works!

BTW, it is “__environ” and I have MS C++ in my VS IDE.

Thank you!