# HelloWorldITK on macOS Sequoia 15.0.1 cannot find stdio.h

**URL:** <https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288>\
**Category:** Beginner Questions\
**Created:** [October 30, 2024, 1:04am UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288 "2024-10-30T01:04:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy](https://discourse.itk.org/user_avatar/discourse.itk.org/andy/32/4388_2.png) [@Andy](https://discourse.itk.org/u/Andy)\
**Post date:** [October 30, 2024, 1:04am UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288/1 "2024-10-30T01:04:21Z")

</div>

On macOS 15.0.1, I’m building up to compiling the HelloWorldITK code by starting with the very basic HelloWorld that works just fine.

CMakeLists.txt:

```auto
cmake_minimum_required(VERSION 3.10)
project(HelloWorld) 
add_executable(${PROJECT_NAME} main.cxx)

```

main.cxx:

```auto
#include <iostream>
int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

```

But even without adding `#include "itkImage.h"` to main.cxx, when I just add this to CMakeLists.txt:

```auto
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

```

After `cmake ..` and `make`, I get errors like

> % make  
> [50%] Building CXX object CMakeFiles/HelloWorld.dir/main.cxx.o  
> In file included from HelloWorld/main.cxx:1:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/iostream:43:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/ios:223:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/\_\_locale:15:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/\_\_memory/shared\_ptr.h:14:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/\_\_compare/compare\_three\_way.h:13:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/\_\_compare/three\_way\_comparable.h:12:  
> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/\_\_compare/common\_comparison\_category.h:15:  
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/cstddef:46:5: error: tried including \<stddef.h\> but didn’t find libc++'s \<stddef.h\> header. This usually means that your header search paths are not configured properly. The header search paths should contain the C++ Standard Library headers before any C Standard Library, and you are probably using compiler flags that make that not be the case.

ITK was installed with homebrew

---

<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:** [October 30, 2024, 1:41pm UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288/2 "2024-10-30T13:41:11Z")

</div>

What happens if you add this to your CMakeLists.txt:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/ca8b823a950aceecb4eb490a6ebf2064c85b0fd7/CMake/ITKInitializeCXXStandard.cmake#L3>

---

<div class="post-metadata">

**Author:** ![Andy](https://discourse.itk.org/user_avatar/discourse.itk.org/andy/32/4388_2.png) [@Andy](https://discourse.itk.org/u/Andy)\
**Post date:** [October 30, 2024, 5:02pm UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288/3 "2024-10-30T17:02:39Z")

</div>

Thanks, Dženan. Adding that didn’t seem to change anything.

Using verbose cmake/make commands, I was able to see the compilation step:

```auto
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ \
-DH5_BUILT_AS_DYNAMIC_LIB \
-DITK_FFTIMAGEFILTERINIT_FACTORY_REGISTER_MANAGER \
-DITK_IMAGEIO_FACTORY_REGISTER_MANAGER \
-DITK_MESHIO_FACTORY_REGISTER_MANAGER \
-DITK_TRANSFORMIO_FACTORY_REGISTER_MANAGER \
-Dkiss_fft_scalar=double \
-I/Users/andy/HelloWorld/build/ITKFactoryRegistration \
-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include \
-isystem /usr/local/include \
-isystem /usr/local/include/gdcm-3.0 \
-isystem /usr/local/include/ITK-5.3 \
-isystem /usr/local/include/eigen3 \
-isystem /usr/local/include/vtk-9.3 \
-isystem /usr/local/include/vtk-9.3/vtkfreetype/include \
-std=c++14 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk \
-mmacosx-version-min=15.0 \
-MD \
-MT CMakeFiles/HelloWorld.dir/main.cxx.o \ 
-MF CMakeFiles/HelloWorld.dir/main.cxx.o.d \
-o CMakeFiles/HelloWorld.dir/main.cxx.o \
-c /Users/andy/ITK/HelloWorld/main.cxx

```

That command works if I take out the line

```auto
-I/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include \

```

So it looks like the `find_package(ITK REQUIRED)` is adding more than it should. My computer is set to use MacOSX15.sdk – I don’t know where the “14” is coming from. But even if I change that line to use “15” instead, it gets the same error. ¯\_(ツ)\_/¯

---

<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:** [October 30, 2024, 5:21pm UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288/4 "2024-10-30T17:21:35Z")

</div>

> [@Andy](#):
>
> ITK was installed with homebrew

Homebrew’s version might be compiled with v14 SDK.

Someone more familiar with MacOS might have advice. Maybe @seanm?

---

<div class="post-metadata">

**Author:** ![Andy](https://discourse.itk.org/user_avatar/discourse.itk.org/andy/32/4388_2.png) [@Andy](https://discourse.itk.org/u/Andy)\
**Post date:** [October 30, 2024, 8:22pm UTC](https://discourse.itk.org/t/helloworlditk-on-macos-sequoia-15-0-1-cannot-find-stdio-h/7288/5 "2024-10-30T20:22:20Z")

</div>

Thanks for the tip! I was able to get it to work by adding these lines to CMakeLists.txt:

```auto
# Set the macOS deployment target
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.5" CACHE STRING "Minimum OS X deployment version")

# Specify the path to the desired SDK
set(CMAKE_OSX_SYSROOT /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk)

```
