Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 2.75 KB

compilation_info.md

File metadata and controls

38 lines (25 loc) · 2.75 KB

PCL/Boost not compiling with MSVC2019

C2116 and C2733 errors

Source

It's a compatibility problem between boost interprocess and MSVC 2019. According to Microsoft you can use a not-yet-documented compatibility switch in MSVC 2019 to prevent the C2116 and C2733 errors relating to redeclaration of extern "C" functions. This option is /Zc:externC-

This leaves a couple of C4996 errors relating to use of insecure CRT functions. Per the error message, these can be suppressed by writing #define _CRT_SECURE_NO_WARNINGS before the header files are included.

defined _CRT_SECURE_NO_WARNINGS

Due to pcl-1.9\pcl/io/low_level_io.h(73,16): error C4996: '_open': This function or variable may be unsafe. Consider using _sopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

defined _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING

Due to PCL 1.9.1\3rdParty\Boost\include\boost-1_68\boost/iostreams/positioning.hpp(96,15): error C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The member std::fpos::seekpos() is non-Standard, and is preserved only for compatibility with workarounds for old versions of Visual C++. It will be removed in a future release, and in this release always returns 0. Please use standards-conforming mechanisms to manipulate fpos, such as conversions to and from streamoff, or an integral type, instead. If you are receiving this message while compiling Boost.IOStreams, a fix has been submitted upstream to make Boost use standards-conforming mechanisms, as it does for other compilers. You can define _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING to acknowledge that you have received this warning, or define _REMOVE_FPOS_SEEKPOS to remove std::fpos::seekpos entirely.

According to this thread it's fine to just define _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING even though it would then only return 0 in this realease.

When it follows that codepath, it doesn't use only the zero, it combines it with another non-zero value so that it should still produce the correct answer.

But if you want to avoid it entirely, then you need to do one of:

  1. Use the 14.0 toolset.
  2. Wait for the release of Boost 1.69.
  3. Apply this patch to your local Boost: https://github.com/boostorg/iostreams/pull/57/files

As I said before, defining _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING is sufficient for Boost 1.68; it will still just work. Doing the above is optional but will let you resolve the issue without defining that.

fpos.hpp is a configuration header used by positioning.hpp.

The change to fpos.hpp makes positioning.hpp use a different code path that no longer calls (or compiles any calls to) seekpos().