1
votes

I created a Qt project which is working and now I want to interface with some third party libraries. I have used Qt Creator to "Add Existing Directory..." to the header folder. I browse to the folder and it does add the header files to the .pro file.

HEADERS += \
   mainwindow.h \
   ... more of my files ...
   ../../ComponentLib/src/Component.h \
   ... other files from ComponentLib ...

When I do this it shows up in the headers folder in the project view but my include statements don't work.

#include "Component.h"//results in "No such file or directory"

On the other hand, if I copy the header files in question into my project directory, I can add them as existing files and my include statement works. When I try to compile, I find that those new headers have other dependencies and I end up having to copy ALL the files. I'd be happy to do this, except that really should be able to import the whole third party library and then include the files I want.

I expect that there is a Qt Creator step I have missed. Any ideas?

-----------------------EDIT-----------------------

I was able to find a solution in part. How to add include path in Qt Creator? indicates that I can directly put the path into my .pro file. Still, there should be some way to do this automatically. Is there a feature which Qt Creator has to do this?

1
What do you mean automatically for you?eyllanesc
@eyllanesc Qt Creator is an IDE. To my way of thinking that means that if there is a manual operation like this, there is probably support for the action integrated into the environment. If this was an import of a library, it would appear that it does this. I'm hoping there is a similar tool I may have missed which applies to include paths.BSD
This task does not exist but there is a tool to import libraries, check the following: stackoverflow.com/a/45122693/6622587eyllanesc

1 Answers

2
votes

I dont now how it make automatically, but i usually add include paths in my .pro file like this enter image description here