google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
7.1k stars 2.07k forks source link

Compile error when installed with vcpkg #1107

Closed OrientalSiru closed 5 months ago

OrientalSiru commented 5 months ago

I am using the non-CMake version of Visual Studio, and I installed glog with vcpkg. However, I get the following error when trying to include the library:

Error C1189 #error: <glog/logging.h> was not included correctly. See the documention for how to consume the library.

Tried to resolve the above by adding #define GLOG_USE_GLOG_EXPORT, I get another error:

Error C4996 google::CustomPrefixCallback': Use PrefixFormatterCallback instead.

Repro

  1. Install glog using vcpkg: .\vcpkg\vcpkg.exe install glog
  2. Create a new visual studio c++ console app
  3. Include #include <glog/logging.h>
  4. Build
sergiud commented 5 months ago

What is your question? Especially given the compiler messages are self-explanatory.

In general, we do not support non-CMake builds. We also do not maintain the vcpkg version of glog.

If you choose to integrate glog from scratch, you need to replicate the compiler options and defines set by CMake.

sergiud commented 5 months ago

I'm closing the issue since the problem is clearly caused by incorrect/unsupported glog integration. Note that similar questions have been asked before: #1091 #1079. The documentation also explicitly states that Bazel or CMake integration is required. Therefore, the issue is not actionable.

OrientalSiru commented 5 months ago

@sergiud Do you know who maintains the vcpkg version of glog? vcpkg claims to support non-CMake builds, so I was hoping it has a solution to make it work with non-CMake.

sergiud commented 5 months ago

The documentation contributed to glog states that the packages are maintained by the vcpkg project.