PDA

View Full Version : Configuring project with 3rd party api



gpuckett
24th April 2015, 21:08
I have been developing a Windows based Qt application for some time now utilizing Qt Creator. It is my first C++ application and I am getting to a point where I am struggling. I really need some help.

The application requires a 3rd party API. The API came with all the necessary instructions on how to set up the Qt application with the proper include path and necessary libs so it has been going smoothly. Now I am at a point where I need to generate custom shape files that will be used by the main application. Based on research in a lot of forums I chose the GDAL/OGR API to accomplish this. I even found a coding example for reading and writing shapefiles using OGR. My problem is I can't find any documentation that helps me properly set up the project to be able to use the API. When I try to build some test code that uses GDAL I get errors for missing lib files or missing obj files. Without specific documentation I don't have a clue how to determine how to set up the project. So far I haven't been able to find any. That's why I'm asking for help on the Qt forum.

I am primarily a Java developer and used to having everything in JAR files. So I am still learning a lot about C++. For C++ development I think I understand the relationship between the code, the lib files and the DLLs but I am totally lost trying to determine how to put a project together for specific APIs. I understand that the directory containing the 3rd party headers are added to the include path. I also understand that the necessary DLLs are placed either in the path or directly in the directory where the exe file is. I think my main problem is understanding how to identify which lib files match which header files. Or am I totally off base here?

If someone is familiar with using GDAL with Qt would you please give me some assistance with my GDAL setup? If not, would someone please give me some pointers as to how to figure this out?

I really appreciate it!!!

ChrisW67
25th April 2015, 22:59
I am assuming you are using QMake

You use any third party library in much the same way.

Add a path or paths to INCLUDEPATH to allow the C++pre-processor to find the library headers during compilation
Add a path or paths to LIBS using -L options to allow the linker to find the library files during linking
Add a name or names to LIBS using -l options to name the libraries you want the linker search for symbols during linking

In the case of dynamically loaded libraries: they must be located at run time either:

In the same directory as the executable or on the system PATH on Windows
On the UNIX LD_LIBRARY_PATH.


Perhaps you could elaborate on where in the process you are getting problems, and what the error or warning messages are.