Can't compile using MSVC & IVF on windows (MSVS 14)


A requirement of a project I am working on is to statically link against CGNS on windows, including the Fortran interfaces.

I have tried to compile on Windows 10, using the CMake files and using the "Visual Studio 14 2015 Win64" generator. The C compiler is the default MSVC compiler, and the fortran compiler is Intel IVF 18.0.3.

I have tried setting the CMake configuration according to both the "Building on Windows" section of the FAQ, and the configure options being passed to CMake in the AppVeyor CI testing in the main CGNS repository.

I have downloaded the v3.3.1 release from the github releases page.

UPDATE: A work around has been identified

The work around is to explicitly set the linker language to C for `cgns_static`


Here is the external project definition and configuration that I am using:

I run CMake to configure and build the CGNS portion of the project (HDF5 was already installed, v1.10.3, from like this:


Izaak Beekman
December 4, 2018, 4:06 PM

PR opened at Testing locally on Windows to confirm fix.

Izaak Beekman
December 5, 2018, 3:11 PM

I can confirm that the build now succeeds on Windows under MSVS with Fortran enabled.

A corresponding issue has been opened on teh CMake bug tracker:

A minor problem remains: The installation of the cgns `.mod` file fails due to the way MSVS behaves. The CMake installation is not looking under the `$<CONFIG>` subdirectory for the module file, and thus the installation of the .mod file is failing. I'll try to add a fix for that here as well.

Izaak Beekman
December 14, 2018, 5:42 PM

PR: is ready to merge, AFAICT. Please let me know if anyone has any concerns that I can address, changes they would like to see, etc.

Scot Breitenfeld
February 11, 2019, 6:48 PM

Can this be closed?

Izaak Beekman
February 11, 2019, 6:56 PM

I think so. I haven't had time to test the latest release. I've also noticed that MSVS does not seem to do well with mixed language targets. I have doubts that the object library is linking correctly when built with MSVS. But for not, this seems resolved enough.

For the application/project I am working on, in the end, my test seemed to fail due to HDF5, which is a different kettle of fish. It is possible that bugs remain with Intel Fortran and MSVS, but we've factored out the code requiring CGNS, and added flags to turn it on and off. So for now, we are skipping CGNS on Windows.

I would recommend, even though it's obnoxious, compiling fortran and C libraries separately to better accommodate MSVS. This is somewhat different than the present issues, so I am happy to mark this as resolved, at least for now.


Izaak Beekman


Izaak Beekman

Fix versions

Affects versions