baresip/re

HAVE_THREADS and Visual Studio 2022, version 17.8

Closed this issue · 2 comments

jvxgit commented

Hi,
I just installed latest version of VS 2022 yesterday, version 17.8. Starting from version 17.8, MS declares to support c++ threads,

https://devblogs.microsoft.com/cppblog/c11-threads-in-visual-studio-2022-version-17-8-preview-2/

In libre, CMake checks for the existence of c++ threads,

check_function_exists(thrd_create HAVE_THREADS)
if(HAVE_THREADS)
list(APPEND RE_DEFINITIONS -DHAVE_THREADS)
endif()

CMake returns that, yes, it supports c++ threads. But then, it seems that Microsoft forgot to add the header file <threads.h>. So, I have found HAVE_THREADS to be true but then, compilation fails since <threads.h> can not be found in re_threads.h. CMake only checks for the existence of the symbol thrd_create but it does not look for the header as it seems..

My workaround is to comment out these lines with HAVE_CONFIG in <re_config.cmake> when using Visual Studio 2022. Or am I missing something?

Best regards

Hauke

Thanks for reporting should be fixed by #1005

It's strange that threads.h is not available but mentioned in the blog post. Found no flag or other workaround.

I think it was a mistake in setup authoring. It was filed on Developer Community here: https://developercommunity.visualstudio.com/t/Missing-threadsh-in-MSVC-178/10514752