Windows build, unordered_map

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

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).

1 Like

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. :confused:

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.

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

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

1 Like

Probably the best is to follow the official documentation:

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.


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:

It is based on a couple try compiles.


1 Like

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

What I ended up doing in the meantime is - I’m checking existence of header using the Internal version numbering:

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