My VS project uses protobuf, which is accessed using the system-wide integration feature of vcpkg. When I link my project I get the following
1>...: error LNK2001: unresolved external symbol "public: virtual char const * __cdecl google::protobuf::FatalException::what(void)const " (?what@FatalException@protobuf@google@@UEBAPEBDXZ)
1>...: error LNK2001: unresolved external symbol "public: virtual __cdecl google::protobuf::FatalException::~FatalException(void)" (??1FatalException@protobuf@google@@UEAA@XZ)
The problem seems to be that PROTOBUF_USE_EXCEPTIONS is used to conditionally declare and define these functions in protobuf library common.h and common.cc, respectively. PROTOBUF_USE_EXCEPTIONS is defined in my project (seems to be the default for my project), so the header declares the functions. But, it is presumably not defined when vcpkg builds protobuf and so the functions are not defined.
How can I define PROTOBUF_USE_EXCEPTIONS when vcpkg builds protobuf?
I'm using VS2022 preview 4.1, protobuf 3.18.0, and vcpkg (2021-09-10-2059ef11aa6067e6f59b0d939c5d17e3c5c47d3e)