Reputation: 617
I've imported a C++ project (Shrewsoft VPN) into Qt creator.
Some include statements fail, because the included file cannot be found e. g.
#include <openssl/rand.h>
I know where the openssl/rand.h
file resides. But I don't know the paths Qt / C++ compiler looks for it.
Is there a way to get a list of all paths Qt searches for this header files?
Upvotes: 1
Views: 2570
Reputation: 561
Qt searches header files in 3 way,
The first search path is your compiler path, exp. With MSVC2015 it will search in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
The second search path is your Qt version folder and linked Qt library, exp. With Qt5.9.2 and widgets library, it will search in C:\Qt\5.9.2\msvc2015_64\include\QtWidgets
The last search path is your external header path contain in your INCLUDEPATH var parsed with QMake.
For openssl in windows app you need to add
QT += core gui network
win32{
LIBS += -LC:/OpenSSL-Win32/lib -lubsec
INCLUDEPATH += C:/OpenSSL-Win32/include
}
to your project file, and replace C:/OpenSSL-Win32/ with your downloaded OpenSSL path.
Upvotes: 0
Reputation: 11513
There are two things that influence the search path: The build environment and the project settings. The build environment is typically inherited from the system, and the project settings are defined in you .pro file
In Qt Create 4.3, you can see the build environment in
Project (on the left pane) > Build > Build Environment > Details > INCLUDE
But I recommend to add the include path in your project file. Add this in your .pro file:
INCLUDEPATH += (Base Path to openssl includes)
You may also need to extend the library search path for linking:
LIBS += -L(Path to openssl libs) -l(openssl lib name)
Upvotes: 4