Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. `GDALAllRegister@0' when linking GDAL to Qt
Forum Updated to NodeBB v4.3 + New Features

`GDALAllRegister@0' when linking GDAL to Qt

Scheduled Pinned Locked Moved 3rd Party Software
2 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sslizz
    wrote on last edited by
    #1

    hello,

    I’ve been trying desperately to link GDAL library to Qt (5.0.1) ., but didn’t succeed. I keep getting error messages every times I use a gal function.
    @
    #include "mainwindow.h"
    #include <QApplication>
    #include <gdal_priv.h>
    #include <cpl_conv.h>
    #include <cpl_string.h>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    GDALAllRegister();

    w.show();
    return a.exec&#40;&#41;;
    

    }

    @

    and my pro file is

    @
    #-------------------------------------------------

    Project created by QtCreator 2013-04-07T21:45:42

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = sans_titre1
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    INCLUDEPATH += "D:/gdal-1.9.2/include"
    LIBPATH += -L"D:/gdal-1.9.2/lib/"
    LIBS += -lgdal_i
    @

    then :

    undefined reference to `GDALAllRegister@0'

    Please help !

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DFileccia
      wrote on last edited by
      #2

      Hi ssliz!

      I have been successully using GDAL since 1.8.x with both VS and MinGW. From the looks of your PRO file you are using VS. Did you make sure the proper __declspec was set when building the library or the GDAL was built by the same VS as your application?

      I have seen this error when both those conditions occur. The former is because no actual symbols are exported. The latter because the name mangling scheme changed between the compilers.

      Here is an example of my PRO file that uses GDAL for the OGR spatial referencing.

      TARGET = Core
      TEMPLATE = lib
      VERSION = 1.0.0

      CONFIG += shared c++11
      QT += sql widgets

      HEADERS +=
      GeodeticToOGR.h
      GeodeticToRaw.h
      GeodeticToUTM.h

      SOURCES +=
      GeodeticToOGR.cpp
      GeodeticToRaw.cpp
      GeodeticToUTM.cpp

      INCLUDEPATH +=
      $$PWD/../include
      $$PWD/..
      $$PWD/../../repo-3rd/include
      D:/MinGW/msys/1.0/include

      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../repo-3rd/lib -lgeographic
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../repo-3rd/lib -lgeographic
      else:unix: LIBS += -L$$PWD/../../repo-3rd/lib -lgeographic

      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../repo-3rd/lib -lgdal
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../repo-3rd/lib -lgdal
      else:unix: LIBS += -L$$PWD/../../repo-3rd/lib -lgdal

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved