External symbol errors when linking Fortran modules

I’m trying to link HDF5 in Visual Studio 2015, but keep getting external symbol errors. An example of one error is:

error LNK2019: unresolved external symbol H5LIB_mp_H5OPEN_F reference in function MAIN__

There are 12 errors overall, all with ‘mp’ in the name and most with ‘_F’ at the end.

From basic googling, it seems like the issue may be to do with the way hdf5 was installed and whether the correct compilers were used. The program I’m working on uses the Intel Fortran compilers. I compiled hdf5 from the CMake-hdf5-1.8.19, following the steps outlined on the ‘Building with CMake’ website (this is on a Windows machine). The full text of the batch file is:

ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201564,FORTRAN_LIBRARIES=YES -C Release -V -O hdf5.log

My question is, if this is the issue, how do I install with ifort instead of whatever the above uses?

Thanks for any help!


CMake will unless told otherwise use the fortran compiler Visual Studio is configured to use. So the “Is it plugged in” question is; what happens when you open the created solution file in Visual Studio and build.



Thank you for your reply.

Visual Studio should be configured to use the Intel compilers. When I open the Solution file and build, it compiles, but I cannot tell from the output which compiler it is using.

If a compiler mismatch is not the issue, do you know what else would cause these external symbol errors? I’m at a loss.


I’m using a mix of C and Fortran code. I noticed in another thread that someone had a similar issue and mentioned using a ‘-standard-semantics’ flag. Could this be the issue?

If so, how would I include this on the Cmake build?


Adding flags to C compiler can be done by adding:

  • set (ENV{CFLAGS} "myflag")
  • set (ENV{CXXFLAGS} "myflag")

to the HDFConfig.cmake file.

However, the problem with the link error is that usually it indicates a missing library or import/export setting.
The way to solve this, is to use VS2015 and open the created solution file in the build folder.
Find the first link issue and inspect the properties in Visual Studio.


When I open HDF5 in Visual Studio, it compiles fine.

The errors only occur when I try to link the module files to another project.

There must be a link line issue - maybe compare one of the fortran examples to your project.
Also, Look at the examples project that are available from within the binaries, the source release download, or the HDF repository.


Fortran mod files are include path files. You are missing an include path to the hdf5 mod files.