Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use GEOS library in QT Creator - Win platform
Qt 6.11 is out! See what's new in the release blog

How to use GEOS library in QT Creator - Win platform

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 5.0k Views 2 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.
  • M Offline
    M Offline
    marceloarguello700
    wrote on last edited by
    #1

    Hi i want to use GEOS (Geometry Engine - Open Source) library in QT, in static way.

    I downloaded version 3.2.0,(http://download.osgeo.org/geos/)
    because it have Visual c++ project file, and i don not how to compile new version on win, then form visual C++ 2008 Express open the VC project file:
    geos-3.2.0\build\msvc90\geos_lib.vcproj
    And build the lib in debug and release version,
    Then get a file named geos.lib of 223MB.

    In the QtCreator pro file add the lib

    win32:LIBS += $$PWD/librerias/geos.lib
    QMAKE_LFLAGS += -Xlinker -Bstatic
    CONFIG += no_lflags_merge

    INCLUDEPATH += $$PWD/librerias
    DEPENDPATH += $$PWD/librerias

    In my cpp test code file, put the include:
    #include "librerias/geos_c.h"

    And in a slot:
    initGEOS(notice, log_and_exit);
    qDebug()<< "GEOS version " << GEOSversion();

    But when compile i get:
    error: undefined reference to `initGEOS'

    error: undefined reference to `GEOSversion()'

    What i am doing wrong?

    Greetings

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      In creator, you are using the same VS 2008 compiler?

      Its looks correct. and you link to .lib as VS likes.
      But the big question is if the geos.lib is a static lib ?

      1 Reply Last reply
      2
      • M Offline
        M Offline
        marceloarguello700
        wrote on last edited by
        #3

        Thanks for the reply; In Qt creator I use mingw,
        The lib and the program must to be compiled with the same compiler,
        or can compile the lib with VS2008 and the program with mingw?

        I do not have experience with external libs, i am stuck with this problem.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          No, on Windows you need to have everything built with the same compiler if you are using C++ libraries.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M Offline
            M Offline
            marceloarguello700
            wrote on last edited by marceloarguello700
            #5

            Hi, thanks for the reply, so now try to compile the lib with mingw,
            download the MSYS, open the shell, go to the folder, and write:

            ./configure
            After some messages get:

            configure: error: no acceptable C compiler found in $PATH

            Reading some forums, mus to add a fstab file
            the etc/fstab file is:

            #Win32_Path Mount_Point
            c:/Qt/Qt5.4.1/5.4/mingw491_32/ /mingw

            Also i try with /bin
            #Win32_Path Mount_Point
            C:/Qt/Qt5.4.1/5.4/mingw491_32/bin

            Also try
            ./configure --prefix=/mingw


            $ mount
            c:\Qt\Qt5.4.1\5.4\mingw491_32 on /mingw type user (binmode)


            $ g++
            sh: g++: command not found


            $ gcc
            sh: gcc: command not found

            There is not gcc.exe or g++.exe file in the c:\Qt\Qt5.4.1\5.4\mingw491_32\bin folder

            What can be wrong

            jsulmJ 1 Reply Last reply
            0
            • M marceloarguello700

              Hi, thanks for the reply, so now try to compile the lib with mingw,
              download the MSYS, open the shell, go to the folder, and write:

              ./configure
              After some messages get:

              configure: error: no acceptable C compiler found in $PATH

              Reading some forums, mus to add a fstab file
              the etc/fstab file is:

              #Win32_Path Mount_Point
              c:/Qt/Qt5.4.1/5.4/mingw491_32/ /mingw

              Also i try with /bin
              #Win32_Path Mount_Point
              C:/Qt/Qt5.4.1/5.4/mingw491_32/bin

              Also try
              ./configure --prefix=/mingw


              $ mount
              c:\Qt\Qt5.4.1\5.4\mingw491_32 on /mingw type user (binmode)


              $ g++
              sh: g++: command not found


              $ gcc
              sh: gcc: command not found

              There is not gcc.exe or g++.exe file in the c:\Qt\Qt5.4.1\5.4\mingw491_32\bin folder

              What can be wrong

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @marceloarguello700 You should use MinGW provided with your Qt installation instead of using MSYS.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 1 Reply Last reply
              2
              • jsulmJ jsulm

                @marceloarguello700 You should use MinGW provided with your Qt installation instead of using MSYS.

                M Offline
                M Offline
                marceloarguello700
                wrote on last edited by
                #7

                @jsulm Thanks for the reply, but it is to short to my knowledge,
                How must to proceed, open Qt Creator and make a new project, or
                open a win console an so what??
                Greetings

                T jsulmJ 2 Replies Last reply
                0
                • M marceloarguello700

                  @jsulm Thanks for the reply, but it is to short to my knowledge,
                  How must to proceed, open Qt Creator and make a new project, or
                  open a win console an so what??
                  Greetings

                  T Offline
                  T Offline
                  Tikani
                  wrote on last edited by
                  #8

                  @marceloarguello700 If I have some problems with Qt build toolchan on Windows, I simply uninstall entire Qt, and make clean reinstall after that. On installation I tick in "Tools" MinGW of the latest version and in the list above I tick "Prebuilt components" for MinGW of the same version as it has been ticked earlier.
                  P.S. English is not my mother tongue, sorry for the mistakes, hope you understood all.

                  1 Reply Last reply
                  0
                  • M marceloarguello700

                    @jsulm Thanks for the reply, but it is to short to my knowledge,
                    How must to proceed, open Qt Creator and make a new project, or
                    open a win console an so what??
                    Greetings

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @marceloarguello700 First you need to install MinGW. To do so start the Qt Maintenance Tool go to "Add or remove components" select Tools/MinGW_LATEST_VERSION (currently 5.3.0). Then use that compiler instead of MSYS.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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