-1

Host Environment

  • OS: [Windows 11 using WSL (Ubuntu-22.04)]
  • Compiler: Clang 14.0.0

The issue

Firstly, I did vcpkg install fmt --triplet x64-Linux and everything worked properly. After that, I wrote some configurations in the top-level CMakeLists.txt to find the FMT package. Then, I linked FMT to my executable, and it was built successfully. However, when I include fmt, an error immediately occured.

Top-level CMakeLists.txt 1

CMakeLists.txt in the app subdirectory 2

Main.cpp, the executable that will be generated from; it also shows the error of including FMT 3

Even the IDE managed to suggest FMT, meaning that it knows it exists 4

Further evidence of the package already installed 5

The zip file if you want to inspect

hp_bot.zip

I tried to modify my include directories in the c_cpp_properties.json but found no luck.

Botje
  • 26,269
  • 3
  • 31
  • 41
Brad
  • 17
  • 6
  • Stack Overflow discourages **images** which represent textual information. Instead, paste into the question post the code and error message as **text** with proper formatting. See [ask] and that question on meta: https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors – Tsyvarev Feb 06 '23 at 09:10

1 Answers1

2

There is nothing wrong with your vcpkg installation or CMake file. You are just including the wrong headers.

Instead of

#include <fmt>

(which is a directory) you should include some of the files within that directory:

#include <fmt/core.h>
Botje
  • 26,269
  • 3
  • 31
  • 41