Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cannot #include <fmt> from vcpkg installation

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading