Failed build on Windows using VS2015 (with VS2017 also present on system)

Operating system: Windows 7 Enterprise, Service Pack 1
Slicer version: 4.8.1 (r26813)
Expected behavior: Build from Source
Actual behavior: Build errors in CTK project

I am building the latest stable release of Slicer from source using Visual Studio 2015 under Windows 7. I also have Visual Studio 2017 on my system. All the projects build successfully for me with one exception (CTK), which I think then causes the Slicer project to also fail. The error codes I get are:

  • Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int [C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\CTKWidgets.vcxproj] [C:\Slicer\Build\CTK-build\CTK.vcxproj] CTK C:\Slicer\Build\CTK\Libs\Widgets\ctkPathListButtonsWidget_p.h 60
  • Error C2143 syntax error: missing ‘,’ before ‘&’ [C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\CTKWidgets.vcxproj] [C:\Slicer\Build\CTK-build\CTK.vcxproj] CTK C:\Slicer\Build\CTK\Libs\Widgets\ctkPathListButtonsWidget_p.h 60
  • Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int [C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\CTKWidgets.vcxproj] [C:\Slicer\Build\CTK-build\CTK.vcxproj] CTK C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\moc_ctkPathListButtonsWidget_p.cpp 95
  • Error C2146 syntax error: missing ‘>’ before identifier ‘QItemSelection’ [C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\CTKWidgets.vcxproj] [C:\Slicer\Build\CTK-build\CTK.vcxproj] CTK C:\Slicer\Build\CTK-build\CTK-build\Libs\Widgets\moc_ctkPathListButtonsWidget_p.cpp 95

When Googling the error codes, the only seemingly related discussions I could find were these two: OpenTTD and NAR for Maven

This made me guess that the Windows SDK 10 was the source of the issue. I uninstalled Windows SDK 10 from the computer (via the Control Panel Add/Remove programs), and installed SDK 8.1 from Microsoft.

This doesn’t seem to resolve the issue. Snooping around I see that there are still some apparent remnants of SDK 10 (including the UCRT headers) to be found under C:\Program Files (x86)\Windows Kits\ and C:\Program Files (x86)\Microsoft SDKs\Windows Kits\. I have no idea if these are what’s causing the problem, but when I manually removed any links to these directories in the VC++ Directories for the CTK project, I still get the same errors.

Some VS macros (generated by CMake?) which seem relevant here are:

  • $(DefaultWindowsSDKVersion) : 8.1
  • $(FrameWorkSdkDir) : C:\Program Files (x86)\Windows Kits\8.1\
  • $(SDKVersion) : 10.0
  • $(TargetPlatformVersion) : 8.1
  • $(TargetUniversalCRTVersion) : 10.0.10240.0
  • $(UCRTContentRoot) : C:\Program Files (x86)\Windows Kits\10\
  • $(WindowsSdkDir) : C:\Program Files (x86)\Windows Kits\8.1\

I have tried without success to see where the logic occurs in the CMakeLists.txt and the *.cmake files which might be setting these VS macros, to track down why $(SDKVersion) is being set to 10.0.

Any guidance on how to proceed would be greatly appreciated. I’m loath to uninstall VS 2017 unless I absolutely have to. (I already feel like uninstalling the 10.0 windows kits was more aggressive than I’d prefer, but hoped it might resolve things and let me proceed.)

You need to use the official build configuration (Visual Studio version, Qt version, etc). For building 4.8.1 you may need to use VS2013.

See build instructions for 4.8.1 here.

However, I would recommend to build latest version on master branch instead, Since 4.10 will be out very soon, which will be based on current master branch (4.9.x). See instructions here.

VS2017 has been known to move files from existing installations of other versions:

so try re-running the VS2015 setup if you encounter further problems (while building the recommended configuration mentioned by Andras).

1 Like


Thank you for the heads up about the 4.8 build instructions. I had been following the nightly build instructions because that’s all I could find via the wiki (both from the download page and the developer manual page). For what it’s worth, the instructions for downloading specific Slicer revisions using svn co in §2.3 seem to suggest that this page also applies to building 4.8.1.

As per your suggestion, I’m now trying to build 4.9.0 (r27331) using VS2015. If that doesn’t work, I’ll install VS2013 and follow the 4.8 build instructions.


Good to know, thanks! I don’t expect that’s my issue, since I had VS2017 installed before I installed VS2015. In fact, I had originally tried to build the then current master branch of Slicer from github under VS2017. This was spectacularly unsuccessful, which is what prompted me to install VS2015 and switch the source to the stable release 4.8.1 (hah!).

CMake seems to be working fine for me, whether I launch it from the developer command prompt or from just simply cmd.exe. I also cleaned up my system and user Path environment variables just in case they were pointing to the Windows Kit 10 instead of 8.1 (which one of them was).

For now, I will follow through on the guidance from Andras above; but if it that doesn’t work and it seems that this VS2017 competition might actually be a factor, I’ll look a bit closer into it.

My experience is that you end up corrupting visual studio configuration of you install them out of order (install older version after installing a newer version). To fix that, uninstall all versions and reinstall them in the same order as they were released.


Yikes. Alright, I’ll keep that in mind if I continue to have build problems or if I end up needing to build the stable release and therefore have to install VS2013.

The build I initiated last night seems to have been successful, except for a Qt dependency issue in the Slicer project. Qt 5.11.1 only includes the WebEngine component for VS2017 and not VS2015, so I’m rolling it back to Qt 5.6.3, and trying again.

1 Like

I use Qt 5.10.0 msvc2015_64 with latest VisualStudio (2017 Community) using VS2015 toolset (-T v140).

Very useful to know. Thank you! If my current efforts don’t work out, I’ll give that a go.

Yes, it appears to have completed the build successfully. Many thanks for the guidance!

Great! Which Visual Studio, toolset, and Qt version did you end up using?

I used the default native compilers (x64) under VS2015 and Qt 5.6.3.

I will also try the combination you mentioned, as I would prefer to stick with just one flavour of Visual Studio if I can, and I’m already using the VS2017 IDE for other tasks.

I hit this problem recently, too. @lassoan @jcfr Are there plans to enable compiling with VS2017? Or we stick to Qt 5.10 and earlier for now? Do we know what are the blockers for compiling with VS2017?

We plan to release Slicer-4.10 within days, with VS2015 as officially supported compiler.

After that, we’ll start migration to Python3. We’ll have to match Python’s VS compiler version to be ABI compatible (to be able to pip install any packages into Slicer’s embedded Python). Python 3.6 is built with VS2015, so most likely we’ll stick to it for a while.

We may remove QtWebEngine dependency in Slicer, so we may be able to upgrade Qt while keep using VS2015.


Hi Andras,
Can I use vs 2017 community addition for building slicer 4.10 with qt.5.10.

Saima Safdar

for slicer version 4.10?

Yes, the master branch at the time of earlier posts transitioned to become Slicer 4.10. You can use Visual Studio 2017, but specifically with the VS2015 toolset.

Other build notes for Windows can be found on that same Slicer wiki page.