librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

librealsense failed to build due to error C2280 with /std:c++latest option in VS 2022

Open KarenHuang2016 opened this issue 2 months ago • 4 comments

The MSVC team regularly builds popular open-source projects, including yours, with development versions of the build tools in order to find and fix regressions in the compiler and libraries before they can ship and cause trouble for the world. This also allows us to provide advance notice of breaking changes, which is the case here.

librealsense failed to build due to error C2280 with /std:c++latest option in VS 2022. Could you please help to take a look at this? Thanks in advance!

Repro steps:

  1. Open VS202 x64 CMD.
  2. git clone https://github.com/IntelRealSense/librealsense C:\gitP\IntelRealSense\librealsense
  3. set _CL_=/std:c++latest /D_HAS_AUTO_PTR_ETC=1 /D_HAS_DEPRECATED_ALLOCATOR_MEMBERS /D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING /Zc:strictStrings- /Zc:char8_t- /Zc:equalityRewrite-
  4. cd /d C:\gitP\IntelRealSense
  5. mkdir build_amd64 && cd build_amd64
  6. cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DBUILD_LEGACY_LIVE_TEST=true -DBUILD_EXAMPLES=true -DBUILD_WITH_TM2=true -DCHECK_FOR_UPDATES=true ..
  7. msbuild /m /p:Platform=x64 /p:Configuration=Release realsense2.sln /t:Rebuild

Actual result: 50>C:\gitP\IntelRealSense\librealsense\src\mf\mf-backend.cpp(32,9): error C2280: 'std::basic_ostream<char,std::char_traits> &std::operator <<<std::char_traits>(std::basic_ostream<char,std::char_traits> &,const wchar_t *)': attempting to reference a deleted function [C:\gitP\IntelRealSense\librealsense\build_amd64\realsense2.vcxproj] 50>C:\gitP\IntelRealSense\librealsense\src\mf\mf-backend.cpp(32,9): error C2088: built-in operator '<<' cannot be applied to an operand of type 'std::basic_ostream<char,std::char_traits>' [C:\gitP\IntelRealSense\librealsense\build_amd64\realsense2.vcxproj]

KarenHuang2016 avatar Nov 14 '25 08:11 KarenHuang2016

Hi @KarenHuang2016 Thanks very much for your report. I will discuss it with my RealSense colleagues.

MartyG-RealSense avatar Nov 14 '25 12:11 MartyG-RealSense

Currently the SDK is targeted to C++14 standard. https://github.com/IntelRealSense/librealsense/releases/tag/v2.57.4 Please see under supported languages. Thank you.

hsuys avatar Nov 14 '25 20:11 hsuys

@KarenHuang2016 Thanks for the heads up. Is it possible you suggest a PR that fix it? Does GitHubs Actions support VS 2022?

Nir-Az avatar Nov 23 '25 04:11 Nir-Az

Hi @KarenHuang2016 Can you provide a response regarding the comments from my RealSense colleagues above, please? Thanks!

MartyG-RealSense avatar Dec 06 '25 13:12 MartyG-RealSense