# Cmake issue with minc

**URL:** https://discourse.itk.org/t/cmake-issue-with-minc/6496
**Category:** Engineering
**Tags:** cmake
**Created:** [March 6, 2024, 4:23pm UTC](https://discourse.itk.org/t/cmake-issue-with-minc/6496 "2024-03-06T16:23:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mborish](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@mborish](https://discourse.itk.org/u/mborish)
#### Post date: [March 6, 2024, 4:23pm UTC](https://discourse.itk.org/t/cmake-issue-with-minc/6496/1 "2024-03-06T16:23:19Z")

</div>

Hello,

I’ve recently followed the instructions on ITK’s page to install it via vcpkg. I’ve included the necessary commands:  
find\_package(ITK REQUIRED) and ${ITK\_LIBRARIES} in my target link. However, I get a linking error related to minc2.dll ("👎 error: LNK1181: cannot open input file ‘minc2.lib’). I can confirm that the lib is located with all the other libs in vcpkg’s install folder in my project, but for some reason this linking error persists. Am I supposed to be linking against something related to minc as well? My code is a very simple hello world example:

```
    using ImageType = itk::Image<unsigned short, 3>;
    auto image = ImageType::New();
    std::cout << "ITK Hello World !" << std::endl;

```

Alternatively, I can set my cmake to the suggested output of vcpkg: namely the same find\_package and link against ITKFFT ITKVTK ITKznz itksys. However, when trying to run a simple example of writing an image ([Write an Image — v5.4.0](https://examples.itk.org/src/io/imagebase/writeanimage/documentation)), I get a number of unresolved external symbols related to the writer like the one below:  
main\_window.cpp.obj:-1: error: LNK2019: unresolved external symbol “\_\_declspec(dllimport) public: void \_\_cdecl itk::ImageIOBase::SetNumberOfDimensions(unsigned int)” (\__imp_?SetNumberOfDimensions@ImageIOBase@itk@@QEAAXI@Z) referenced in function “public: virtual void \_\_cdecl itk::ImageFileWriter\<class itk::Image\<unsigned short,1\> \>::Write(void)”

Any thoughts would be appreciated. Thanks!

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [March 6, 2024, 8:20pm UTC](https://discourse.itk.org/t/cmake-issue-with-minc/6496/2 "2024-03-06T20:20:16Z")

</div>

This sounds like a broken ITK build. Or it might be related to `vcpkg`. Try a clean build.

---

<div class="post-metadata">

### Author: ![shai-ikko](https://discourse.itk.org/user_avatar/discourse.itk.org/shai-ikko/32/2842_2.png) [@shai-ikko](https://discourse.itk.org/u/shai-ikko)
#### Post date: [March 13, 2024, 2:38pm UTC](https://discourse.itk.org/t/cmake-issue-with-minc/6496/3 "2024-03-13T14:38:16Z")

</div>

In case this is still relevant: minc2 depends on hdf5 and netcdf. I’d expect vcpkg to handle these dependencies, if minc2 was installed through it (I don’t have easy access to vcpkg to check myself).

---

<div class="post-metadata">

### Author: ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)
#### Post date: [March 18, 2025, 5:47pm UTC](https://discourse.itk.org/t/cmake-issue-with-minc/6496/4 "2025-03-18T17:47:54Z")

</div>

I’m now hitting this same problem. vcpkg appears to correctly build MINC, and `libminc2.a` (I’m on Mac) is present in the vcpkg `lib/` directory. However, vcpkg does not print any useage information for minc, which is not a good sign. I suspect the CMake module for minc is incomplete or missing. This means it’s not possible to use ITKImageIO out of the box with vcpkg, as far as I can tell.
