Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to use GEOS library in QT Creator - Win platform
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:
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:
And in a slot:
qDebug()<< "GEOS version " << GEOSversion();
But when compile i get:
error: undefined reference to `initGEOS'
error: undefined reference to `GEOSversion()'
What i am doing wrong?
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 ?
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.
No, on Windows you need to have everything built with the same compiler if you are using C++ libraries.
marceloarguello700 last edited by 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:
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:
Also i try with /bin
c:\Qt\Qt5.4.1\5.4\mingw491_32 on /mingw type user (binmode)
sh: g++: command not found
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
@marceloarguello700 You should use MinGW provided with your Qt installation instead of using MSYS.
@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??
Tikani last edited by
@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.
@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.