- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi - I was trying to use some code on StackOverflow for a 'thread on exit' function, but it wouldn't compile:
So I tried something simpler, and got the same problem:
#include <iostream> class Test { public: ~Test() { std::cout << "exit" << std::endl; } }; thread_local Test aTest;
The error message is:
error #1897: thread-local variable cannot be dynamically initialized
Should it compile? This is Intel C++ 16.0, in Windows Visual Studio Pro 2012, with C++11 enabled.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dynamic thread_local variables require library support. Microsoft added this support in vs2015. If you'd like to use this feature please get the latest Intel 16.0 compiler (currently, update 1) to use with vs2015.
--Melanie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Melanie - as I mentioned at the bottom of my post, I am using Intel C++ 16.0.
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.1.146 Build 20151021
is there something else I need?
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry - ignore my last reply. I'll try to update VS...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Managed to update to VS2015 (eventually - required re-installation of Parallel Studio) and code now builds; thanks

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page