[gdal-dev] Using GDAL with opencv in C++ there is errors under windows

Mateusz Loskot mateusz at loskot.net
Tue Mar 7 00:46:06 PST 2023


On Tue, 7 Mar 2023 at 09:32, Raivo Rebane <raivo at r-systems.ee> wrote:
>
> I minimized the program :
>
> #include <gdal.h>
> #include <gdal_priv.h>
> #include <iostream>
> #include <conio.h>
>
> int main()
> {
>      GDALAllRegister();
>      GDALDataset* dataset =
> static_cast<GDALDataset*>(GDALOpen("634632_2012_tava.tiff", GA_ReadOnly));
>      GDALClose(dataset);
>
>      return 0;
> }
>

The errors like
  LNK2001 unresolved external symbol
typically mean a program is not being linked against required libraries.

You need to refer to documentation of the compilation toolset you are using
in order to learn how to configure build of your program properly,
how to pass gdal.lib to its linker, etc.
If you are using CMake, you can follow this recommendation
https://gdal.org/development/cmake.html

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list