# Windows build, unordered\_map

**URL:** <https://discourse.slicer.org/t/windows-build-unordered-map/174>\
**Category:** Development\
**Tags:** build\
**Created:** [April 22, 2017, 9:42am UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174 "2017-04-22T09:42:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdiprima](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tdiprima/32/9469_2.png) [@tdiprima](https://discourse.slicer.org/u/tdiprima)\
**Post date:** [April 22, 2017, 9:42am UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/1 "2017-04-22T09:42:31Z")

</div>

Hi all,

I’m using the `<tr1/unordered_map>` header and `std::tr1` namespace in one of my programs. Works fine for Linux.

During the nightly build for Windows, I’m getting errors.

I believe `#include <unordered_map>` is available with Visual Studio 2012 (this is the compiler you’re using, right?)

Just looking for a sanity check. That’s it, right? No namespace, it’s just `unordered_map`, correct?

Thanks a lot.

– Tammy

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 22, 2017, 11:53am UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/2 "2017-04-22T11:53:56Z")

</div>

The officially supported compiler on Windows is VS2013. You can download it for free (the free Community edition is functionally the same as the professional editions).

---

<div class="post-metadata">

**Author:** ![tdiprima](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tdiprima/32/9469_2.png) [@tdiprima](https://discourse.slicer.org/u/tdiprima)\
**Post date:** [April 22, 2017, 3:26pm UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/3 "2017-04-22T15:26:33Z")

</div>

Thank you for the correct version. Now all I need is to get Windows. And I’m so _not_ a Windows person, I feel all thumbs with it. 😕

If by any chance anybody else has come across this, could you please let me know what worked? I feel like I’m close to solving this…

Thanks again.

---

<div class="post-metadata">

**Author:** ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)\
**Post date:** [April 22, 2017, 3:45pm UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/4 "2017-04-22T15:45:09Z")

</div>

If you don’t have Windows, I recommend the virtual machine provided by Microsoft.

[https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/)

Regarding your original question, you probably need to remove the “tr1” part for MSVC.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 22, 2017, 8:03pm UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/5 "2017-04-22T20:03:12Z")

</div>

Probably the best is to follow the official documentation:  
[https://msdn.microsoft.com/en-us/library/bb982522(v=vs.120).aspx](https://msdn.microsoft.com/en-us/library/bb982522(v=vs.120).aspx)

It is specified there what header to include and what namespace the class is in.

If you update your code according to the documentation but you still have build errors on the factory then let me know and I’ll have a look.

---

<div class="post-metadata">

**Author:** ![blowekamp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/blowekamp/32/1386_2.png) [@blowekamp](https://discourse.slicer.org/u/blowekamp)\
**Post date:** [April 25, 2017, 5:33pm UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/6 "2017-04-25T17:33:10Z")

</div>

Hello,

Using TR1 features can be really tricky across platforms. You have a couple things to look out for:

- Is C++11 being used? ( using the tr1 spec or the C++11 spec? )
- the location of the header ( some require the tr1 subdirectory ).
- Is the header even available?

Specifically, with OS X and clang the behavior is dependent on if libstdc++ or libc++, this header may not even be available with out C++11.

In SimpleITK I use this same header, I wrote a little wrapper which may be useful:

> <https://github.com/SimpleITK/SimpleITK/blob/next/Code/Common/include/nsstd/unordered_map.h>

It is based on a couple try compiles.

HTH,  
Brad

---

<div class="post-metadata">

**Author:** ![tdiprima](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tdiprima/32/9469_2.png) [@tdiprima](https://discourse.slicer.org/u/tdiprima)\
**Post date:** [April 26, 2017, 1:36pm UTC](https://discourse.slicer.org/t/windows-build-unordered-map/174/7 "2017-04-26T13:36:12Z")

</div>

Cool. Thank you very much! 🙂  
I’ll use that in our next release.

What I ended up [doing](https://github.com/SBU-BMI/SlicerPathology/blob/cdba3a3fa218d587e782cad5430b581d554ff613/QuickTCGA/Logic/NucleusSeg_Yi/ConnComponents.h#L13-L19) in the meantime is - I’m checking existence of header using the [Internal version numbering](https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B):

> ```
> values of _MSC_VER for various versions of the Visual C++ compiler:
> MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
> 
> ```
