# Can't find MPI C library for Windows

**URL:** https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679
**Category:** Usage
**Tags:** os:windows
**Created:** [August 5, 2023, 12:12am UTC](https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679 "2023-08-05T00:12:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ThienNZ](https://discourse.cmake.org/user_avatar/discourse.cmake.org/thiennz/32/3676_2.png) [@ThienNZ](https://discourse.cmake.org/u/ThienNZ)
#### Post date: [August 5, 2023, 12:12am UTC](https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679/1 "2023-08-05T00:12:10Z")

</div>

Hi,

I’m very new to using CMake trying to do something similar to this user and their [post](https://discourse.cmake.org/t/cmake-3-23-2-error-could-not-find-mpi-c-on-macbook-pro-os-10-13-6-elmerfem-findmpi/6161). Hopefully this is the right place to ask for help.

I’m trying to include Microsoft MPI (MSMPI) into this build which is the library I’m having difficulties with. I have MSMPI installed from a previous build of the program and haven’t been able to find the corresponding library in the program files for MSMPI.

If someone has been able to include MSMPI into their builds successfully for a Windows machine and help me out I would be super appreciative? Thanks in advance!

> cmake -G “MSYS Makefiles” -DWITH\_ELMERGUI:BOOL=TRUE -DWITH\_MPI:BOOL=TRUE -DWITH\_Hypre:BOOL=TRUE -DCMAKE\_INSTALL\_PREFIX=…/install -DCMAKE\_Fortran\_COMPILER=/mingw64/bin/gfortran.exe -DQWT\_INCLUDE\_DIR=C:/msys64/mingw64/include/qwt-qt5/ -DWIN32:BOOL=TRUE -DCPACK\_BUNDLE\_EXTRA\_WINDOWS\_DLLS:BOOL=TRUE …/elmerfem  
> CMake Warning (dev) at CMakeLists.txt:17 (PROJECT):  
> cmake\_minimum\_required() should be called prior to this top-level project()  
> call. Please see the cmake-commands(7) manual for usage documentation of  
> both commands.  
> This warning is for project developers. Use -Wno-dev to suppress it.
> 
> – The Fortran compiler identification is GNU 13.2.0  
> – The C compiler identification is GNU 13.2.0  
> – The CXX compiler identification is GNU 13.2.0  
> – Detecting Fortran compiler ABI info  
> – Detecting Fortran compiler ABI info - done  
> – Check for working Fortran compiler: C:/msys64/mingw64/bin/gfortran.exe - skipped  
> – Detecting C compiler ABI info  
> – Detecting C compiler ABI info - done  
> – Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped  
> – Detecting C compile features  
> – Detecting C compile features - done  
> – Detecting CXX compiler ABI info  
> – Detecting CXX compiler ABI info - done  
> – Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped  
> – Detecting CXX compile features  
> – Detecting CXX compile features - done  
> CMake Warning (dev) at CMakeLists.txt:20 (CMAKE\_MINIMUM\_REQUIRED):  
> Compatibility with CMake \< 2.4 is not supported by CMake \>= 3.0.  
> This warning is for project developers. Use -Wno-dev to suppress it.
> 
> CMake Deprecation Warning at CMakeLists.txt:20 (CMAKE\_MINIMUM\_REQUIRED):  
> Compatibility with CMake \< 3.5 will be removed from a future version of  
> CMake.
> 
> Update the VERSION argument value or use a … suffix to tell  
> CMake that the project does not need compatibility with older versions.
> 
> – Checking whether GFortran version \>= 7 – yes  
> CMake Warning at cmake/Modules/FindMPI.cmake:406 (message):  
> Unable to find MPI library :libmsmpi.dll.a  
> Call Stack (most recent call first):  
> cmake/Modules/FindMPI.cmake:597 (interrogate\_mpi\_compiler)  
> CMakeLists.txt:227 (FIND\_PACKAGE)
> 
> CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):  
> Could NOT find MPI\_C (missing: MPI\_C\_LIBRARIES)  
> Call Stack (most recent call first):  
> cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (\_FPHSA\_FAILURE\_MESSAGE)  
> cmake/Modules/FindMPI.cmake:615 (find\_package\_handle\_standard\_args)  
> CMakeLists.txt:227 (FIND\_PACKAGE)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 7, 2023, 11:26am UTC](https://discourse.cmake.org/t/cant-find-mpi-c-library-for-windows/8679/2 "2023-08-07T11:26:22Z")

</div>

> [@ThienNZ](#):
>
> cmake -G “MSYS Makefiles”

Are you sure that MSMPI is compatible with a MinGW toolchain?

> [@ThienNZ](#):
>
> Unable to find MPI library :libmsmpi.dll.a

It seems to be searching for a MinGW build of MSMPI, not the `.lib` that actually exists in the SDK.
