Link to GDAL Library
-
Hello
Thank you so much for this
i understand now : i need to set the name of the lib.i have tried this :
LIBS += -L$$PWD/gdal212/lib/ -lgdali get this : : -1: erreur : cannot find -lgdal
i checked the lib repertory. There is no lgdal.lib file. there is a gdal_i.lib fil
So i tried this : LIBS += -L$$PWD/gdal212/lib/ -gdal_i
i get this : D:\Documents\qt\ATS_test\main.cpp:13: erreur : undefined reference to `GDALAllRegister@0'I am not a very advanced user, so i'm doing something wrong, but what ?
Thanks in advance for your help
-
@TremblayGIS -l is the parameter telling the linker to link against the lib which is following the parameter - you need to keep it!
It should be:LIBS += -L$$PWD/gdal212/lib/ -lgdal_i
-
Hello
So i tried this : LIBS += -L$$PWD/gdal212/lib/ -lgdal_i
i still get this : D:\Documents\qt\ATS_test\main.cpp:13: erreur : undefined reference to `GDALAllRegister@0'i guess i have an issue about my connexion with the lib.
How can i check if something else is wrong ?
regards -
Hi
Is the GDL Library compiled with same version of the compiler you use for the test project?
Meaning both are mingw or both are visual studio compiler?If you have downloaded the LIB file precompiled, it might not be compatible with the compiler you use.
-
Hello
indeed in use *.lib files.
Do you suggess me to compile by myself the .cpp files ?regards
-
@TremblayGIS
Hi, on windows you cannot mix libs/dlls from visual studio and mingw compiler.
Or reverse. You can also have issued using same compiler , but differnt version.
Like VS2015 and vs2013.
So yes, if you are using mingw compiler and libs are premade with visual studio then
the only road forward is compile it yourself.So check the docs for the GDAL and see what you really have downloaded :)
-
Hi
you are right the .lib where compiled with VS so i need to do it my self.One i got the .cpp and .h files, could i compile them with qt ? What kind of compiler does qt use ?
Sorry in advance if my question is stupid :(regards
-
@TremblayGIS You don't compile it with Qt - Qt is not a compiler. You compile it with the same compiler you use for Qt - MinGW in your case, right? MinGW is usually located in c:\Qt\Tools\mingw...\bin
-
@TremblayGIS
I use GDAL pretty extensively on both Linux and Windows using MSYS2 toolkit. Building GDAL is super easy on MSYS2 and Linux (although Linux may have a distro) using the configuration tools.For both it is:
./autogen.sh
./configure
makeYou can download binaries, usually, for V$.
You should copy the gdal*.dll to your build folder as GDAL mostly installs a shared library.
As a side note, you should also build the PROJ.4 library as GDAL uses it for its geospatial referencing.
-
Hello
sorry for the delay
your suggestions solved my problem :
the lib i got were built with VS... after buidling with MinGW it works
thank you for your help
regards