I have been trying to build a cmake c++ project. More specifically I am trying to use the gdal library in this project. In the CMakeLists.txt it says
find_library(GDAL gdal) after doing some research i found, that visual studio can open cmake files by default as mention in this thread: https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019.
Moreover, visual studio should also automatically include the gdal library once i have set it up with
vcpkg correctly. I've already downloaded the x64-windows version of the library (
vcpkg install gdal:x64-windows) in order to build for the right architecture and made it available via
vcpkg integrate install on a user-wide scope.
After some trial and error, everything works fine now, the toolchain gets included accordingly and the library is found automatically, resulting in a configuration like that:
However, when trying to include the header files (or anything else; see code snippet), visual studio does not seem to link the library correctly as it will result in the error message:
cannot open source file "gdal/gdal.h".
#include <gdal/ogrsf_frmts.h> #include <gdal/gdal.h> #include <gdal>
Where should I further investigate?