Building libwebrtc on WIndows 11 Pro using Visual Studio 2022 Compiler

488 views
Skip to first unread message

Eugene Foley

unread,
Feb 13, 2025, 1:27:07 PMFeb 13
to discuss-webrtc
All,

I was able to build and get a webrtc based app up and running on Linux, but am now trying to do the same on Windows.

Following Aaron Clauson's kindly provided (and very useful) reply to an earlier post of mine, I was able to follow his github README.md (https://github.com/sipsorcery/webrtc-interop/tree/master/libwebrtc#building-webrtclib-on-windows) to get a ways with the window build but ave what i believe is a C++ version issue.

I have Visual Studio 2022 installed, and using the developer command prompt in Visual Studio, running "cl.exe /?" shows me that I have C++17 && C++20 available, but I see that the default is C++ 14:

Screenshot 2025-02-12 184400.png

Per the README.md instructions I set:

SET DEPOT_TOOLS_WIN_TOOLCHAIN=0 # Use Visual Studio installed clang toolchain instead of devtools one. gn gen out/Default --args="is_debug=false rtc_include_tests=false treat_warnings_as_errors=false use_custom_libcxx=false use_rtti=true"
autoninja -C out/Default
Screenshot 2025-02-13 093431.png

The build results in error of:

 error: no template named 'optional' in namespace 'std'
  190 |   virtual std::optional<absl::string_view> GetTlsCipherSuiteName() const = 0;

This makes sense as  std::optional is not available in C++14. 

So ultimately how do i specify the C++ version to 17 (or 20) when using the Visual Studio C++ compiler?

Thank you in advanced.

Aaron Clauson

unread,
Feb 16, 2025, 5:35:48 PMFeb 16
to discuss-webrtc
It's set as a compiler option. If you're using Visual Studio you can set the c++ version by editing the project's properties. If you're using the command line you can us  /std:c++17 or  /std:c++20.
Reply all
Reply to author
Forward
0 new messages