I have installed GeographicLib then added the library in the .pro file of the Qt. After that, I included #include <geographiclib geodesic.hpp=""> and added using namespace GeographicLib in my .cpp code and wrote a simple code.
I have run the code via:</geographiclib>
windows 10
Qt 6.5.3
MSVC2019_64bit
When I run my code I got the attached errors. I want to kindly ask you to help me.
You don't give enough details to diagnose your problem. But it looks
like the linker doesn't know the location of the GeographicLib library.
That would be the place to look.
Can you link any external library to your application? If not, then
you need to seek help in a Qt-specific forum.
I haven't messed with Qt's .pro files for many years. Instead, I build
Qt projects with CMake. (Qt Creator can handle CMake builds.) In this
case, you just use find_package(GeographicLib ...) to tell the system
where to find Geographiclib.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2024-02-10
Dear Charles,
Thank you for your reply.
The following is the .cpp code which I tried to run:
#include"test.h"#include"qdebug.h"#undef GetObject#include<iostream>#include<GeographicLib/Geodesic.hpp>usingnamespacestd;usingnamespaceGeographicLib;//#pragma comment(lib, "GeographicLib-i.lib") // Replace with the actual lib file nameTest::Test(QObject*parent):QObject{parent}{// Create a new Geodesic objectGeographicLib::Geodesicgeod(GeographicLib::Constants::WGS84_a(),GeographicLib::Constants::WGS84_f());// Define the start and end pointsdoublelat1=50.0,lon1=10.0,lat2=50.01,lon2=9.990;// Calculate the total distance between the two points// geod.Inverse(lat1, lon1, lat2, lon2,// GeographicLib::Geodesic::DISTANCE);// Interpolate points at intervals of 100 metersfor(doubles=100;s<=s12;s+=100){doublelat,lon;geod.Direct(lat1,lon1,0,s,lat,lon);qDebug()<<"Point: "<<lat<<", "<<lon;}}
and in the .pro file I have put the path of the GeographicLib:
QT+=quick# 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.0SOURCES+= \
main.cpp \
test.cppRESOURCES+=qml.qrc# Additional import path used to resolve QML modules in Qt Creator's code modelQML_IMPORT_PATH=# Additional import path used to resolve QML modules just for Qt Quick DesignerQML_DESIGNER_IMPORT_PATH=# Default rules for deployment.qnx:target.path=/tmp/$${TARGET}/binelse:unix:!android:target.path=/opt/$${TARGET}/bin!isEmpty(target.path):INSTALLS+=targetHEADERS+= \
test.hwin32:CONFIG(release,debug|release):LIBS+=-L$$PWD/../lib/-lGeographicLib-i#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../lib/ -lGeographicLib-idelse:unix:LIBS+=-L$$PWD/../lib/-lGeographicLib-iINCLUDEPATH+=$$PWD/../includeDEPENDPATH+=$$PWD/../include
As I am using the sample code of the ArcGis which has used qmake so I can not use Qt CMake.
Yes I can use other library such as pcap in my code.
Thank you agian for your response,
Sincerely yours,
Zahra
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your .pro seems OK. But then I don't know the intricacies of .pro
files. How does your application find bin/GeographicLib.dll? Is the bin directory in you PATH?
Your problems are, most likely, nothing to do with GeographicLib but
instead how you use any external library in your program. In this
case, you need to seek help in a Qt-specific forum. Since your sample
code is from ArcGis, maybe you can get help there.
If you do resolve your problem, please post the solution to this forum
so others can benefit from your experience.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2024-02-12
Dear Charles,
Thank you for your reply.
I added the .dll files into my Debug folder and the errors were removed.
Sincerely yours,
Zahra
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To whom it may concern,
I hope you are well.
I have installed GeographicLib then added the library in the .pro file of the Qt. After that, I included #include <geographiclib geodesic.hpp=""> and added using namespace GeographicLib in my .cpp code and wrote a simple code.
I have run the code via:</geographiclib>
windows 10
Qt 6.5.3
MSVC2019_64bit
When I run my code I got the attached errors. I want to kindly ask you to help me.
Thank you in advance,
Sincerely yours,
Zahra
You don't give enough details to diagnose your problem. But it looks
like the linker doesn't know the location of the GeographicLib library.
That would be the place to look.
Can you link any external library to your application? If not, then
you need to seek help in a Qt-specific forum.
I haven't messed with Qt's .pro files for many years. Instead, I build
Qt projects with CMake. (Qt Creator can handle CMake builds.) In this
case, you just use
find_package(GeographicLib ...)
to tell the systemwhere to find Geographiclib.
Dear Charles,
Thank you for your reply.
The following is the .cpp code which I tried to run:
and in the .pro file I have put the path of the GeographicLib:
As I am using the sample code of the ArcGis which has used qmake so I can not use Qt CMake.
Yes I can use other library such as pcap in my code.
Thank you agian for your response,
Sincerely yours,
Zahra
Your .pro seems OK. But then I don't know the intricacies of .pro
files. How does your application find
bin/GeographicLib.dll
? Is thebin
directory in youPATH
?Your problems are, most likely, nothing to do with GeographicLib but
instead how you use any external library in your program. In this
case, you need to seek help in a Qt-specific forum. Since your sample
code is from ArcGis, maybe you can get help there.
If you do resolve your problem, please post the solution to this forum
so others can benefit from your experience.
Dear Charles,
Thank you for your reply.
I added the .dll files into my Debug folder and the errors were removed.
Sincerely yours,
Zahra