QGiS Windows Source Build
-
It gives around 27 different errors like:
:-1: error: C:\Users\D Besta\Documents\simpleqgistest\build\Desktop_Qt_6_6_3_MinGW_64_bit-Debug/../../main.cpp:24: undefined reference to `__imp__ZN19QgsProviderRegistry8instanceERK7QString' :-1: error: C:\Users\D Besta\Documents\simpleqgistest\build\Desktop_Qt_6_6_3_MinGW_64_bit-Debug/../../main.cpp:27: undefined reference to `__imp__ZN14QgsVectorLayerC1ERK7QStringS2_S2_RKNS_12LayerOptionsE' :-1: error: C:\Users\D Besta\Documents\simpleqgistest\build\Desktop_Qt_6_6_3_MinGW_64_bit-Debug/../../main.cpp:30: undefined reference to `__imp__ZNK11QgsMapLayer7isValidEv' :-1: error: C:\Users\D Besta\Documents\simpleqgistest\build\Desktop_Qt_6_6_3_MinGW_64_bit-Debug/../../main.cpp:36: undefined reference to `__imp__ZNK14QgsVectorLayer12geometryTypeEv' C:\OSGeo4W\apps\qgis-qt6-dev\include\qgis.h:611: error: undefined reference to `__imp__ZN4Qgis16staticMetaObjectE' :-1: error: [Makefile.Debug:72: debug/simpleqgistest.exe] Error 1
And many other such errors
-
@xanthas You're not linking the libraries properly.
On Windows this is wrong:LIBS += -L"C:\OSGeo4W\apps\qgis-qt6-dev\lib" -lqgis_gui -lqgis_core
Please take a look at https://doc.qt.io/qt-6/qmake-variable-reference.html#libs and fix this.
-
I have edited the .pro file to:
LIBS += -L"C:\OSGeo4W\apps\qgis-qt6-dev\lib libs" -lqgis_gui -lqgis_core
I also tried:
LIBS += "-LC:\OSGeo4W\apps\qgis-qt6-dev\lib lib" -lqgis_gui -lqgis_core
The file seems to be there but after what you said suggested it is giving me only this error now:
C:\Qt\Tools\mingw1120_64\x86_64-w64-mingw32\bin\ld.exe:-1: cannot find -lqgis_gui C:\Qt\Tools\mingw1120_64\x86_64-w64-mingw32\bin\ld.exe:-1: cannot find -lqgis_core
When I did this:
LIBS += C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_3d.lib C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_analysis.lib C:\OSGeo4W\apps\qgis-qt6-dev\lib\qgis_app.lib C:\OSGeo4W\apps\qgis-qt6-dev\lib\qgis_native.lib C:\OSGeo4W\apps\qgis-qt6-dev\lib\qgis_server.lib #-lqgis_gui -lqgis_core
Again all the previous errors mentioned arise
-
LIBS += C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_3d.lib \ C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_analysis.lib \ C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_app.lib \ C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_native.lib \ C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_server.lib
Should work (you have \ in the paths which is wrong, don't use \ in in paths in pro files ).
If it does not then next thing to check is: were these libs built using same compiler?
You should also look for the very first linker error/warning. -
You can not mix visual studio and mingw libraries. Either compile all with msvc or use QGIS compiled against mingw.
-
-
This post is deleted!
-
@jsulm said in QGiS Windows Source Build:
\ in the paths
used the abovew as path and still I get
@xanthas said in QGiS Windows Source Build:
27 different errors like
-
@xanthas said in QGiS Windows Source Build:
still I get
Then please read what @Christian-Ehrlicher wrote.
-
@Christian-Ehrlicher
@jsulm
i have tried it and it is giving me 179 errors and I can't find any relative help from other forums as well.
-
@xanthas said in QGiS Windows Source Build:
i have tried it and it is giving me 179 errors
What did you "try"?
If @Christian-Ehrlicher is correct here with:You can not mix visual studio and mingw libraries. Either compile all with msvc or use QGIS compiled against mingw.
trying harder won't solve your problem :)
Either switch to MSVC or find another, MinGW supporting, version of QGIS.
-
@Pl45m4
So what I have understood is that when I download all dependencies and build QGiS from source, I should either use Qt to compile and build libraries or else I should use visual studio to build and compile it, right?
Further, to make the UI and backend codes I should use the same compiler from which I had made the QGiS library, Am I right?What I have understood is the same thing discussed here also, I guess.
-
@xanthas said in QGiS Windows Source Build:
right?
No.
Qt and visual studio are two completely different things.
Qt is a C++ framework, Visual Studio is a IDE.
What @Pl45m4 wrote is: you should use MSVC as compiler + Qt built with MSVC.
Or you find (or build by yourself) QGIS built with MinGW + Qt built with MinGW.
Reason: you cannot mix different C++ compiler (like you do now: MSVC + MinGW). -
can you give me step by step procedure to integrate qgis project in qt to show map in qt C++
i am also facing same issue @jsulm -
@abhishek999 said in QGiS Windows Source Build:
can you give me step by step procedure
In the first post in this thread there is a link to a step by step explanation, follow it...
-
i am facing prolem
here is my .pro file
QT += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
You can make your code fail to compile if it uses deprecated APIs.
In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES +=
main.cpp
mainwindow.cppHEADERS +=
mainwindow.hFORMS +=
mainwindow.uiInclude QGIS headers and libraries manually
INCLUDEPATH += C:\OSGeo4W\apps\qgis-qt6-dev\include
LIBS += C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_3d.lib
C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_analysis.lib
C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_app.lib
C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_native.lib
C:/OSGeo4W/apps/qgis-qt6-dev/lib/qgis_server.libINCLUDEPATH += C:/OSGeo4W64/include
Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target -
@jsulm @Christian-Ehrlicher
can you please tell me what exact is the problem i have reinstall qt ,Qgis ,OSGeo4W multiples time but still same problem i am facing -
You still doing the same thing as in your first post - you use a Qt compiled for MinGW and try to link it against a QGis compiled against MSVC. This will not work out - no matter how often you install something...
-
can you give me the steps to fix this @Christian-Ehrlicher
-
@abhishek999 Again: you have to use Qt built with MSVC compiler. So, install Qr for MSVC and use it...
-
@abhishek999 Currently what I am doing is that rebuilding QGiS using MSVC
If I get anything relevant and the steps starts to works
I will share it here
Please do the same (sharing it here) if you get anything or procedure that has to be followed