I am getting build warning C4275 across my various classes. The code referenced in these warnings is not my code, but library code. I am using vcpkg manifest mode in Visual Studio 17.6.2 with following libraries requested: fmt, jsoncpp, spdlog, libxlsxwriter and armadillo. Note that the versions of the various libraries are defined by what vcpkg installs. The language is ISO C++20 Standard (/std:c++20).
These build messages below are repeated across each class:
1>C:\Users\rswin\OneDrive\source\repos\Prototype\vcpkg_installed\x64-windows\x64-windows\include\fmt\format.h(1055,56): warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'fmt::v10::format_error'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\stdexcept(101,19): message : see declaration of 'std::runtime_error'
1>C:\Users\rswin\OneDrive\source\repos\Prototype\vcpkg_installed\x64-windows\x64-windows\include\fmt\format.h(1055,15): message : see declaration of 'fmt::v10::format_error'
They correspond respectively to following lines of code:
class FMT_API format_error : public std::runtime_error {
_EXPORT_STD class runtime_error : public exception { // base of all runtime-error exceptions
class FMT_API format_error : public std::runtime_error {
I don't recall getting these warning messages prior to including armadillo to the vcpkg manifest, but I made other changes well; so, I am not certain that installation of the armadillo library was the cause. Its code is not referenced in the warnings. Unfortunately, this update to my program in git included quite a few changes, but changes were focus on application of armadillo.
I am unclear why these warning messages are repeated for each class. Whether I include <fmt/format.h> has no impact on warning. I removed all uses of the fmt library in my code, but this had no impact on these warning messages.
This library code is outside my expertise, but could it be a name conflict of "runtime_error" between format.h and stdexcept? If it is a bug, I could try installing the latest version of each library. Still, I was hoping to avoid manual installation of libraries, as I would prefer not to lose the convenience of using manifest mode with vcpkg.
My program still runs, but the 50+ repeats of the above messages are annoying. To resolve I added the following line of code to top of a header that is common to by my various classes.
#pragma warning(disable:4275)
This cleans the build output of these messages, but since I do not know the ramifications for this issue, overriding the warning message may not be a sufficient fix.