How to add a external library on Windows
-
I try to add a external library modifying the .pro file with the following code:
@
win*{
LIBS += -L/C:/CornerStone/include -lMultiWidgets -lFluffy
CONFIG += console
}
@but without success.
[EDIT: code formatting, Volker]
-
-L/C:/CornerStone/include is not a valid search path for additional libraries directories. You should write -LC:/CornerStone/include (without first slash). Are MultiWidgets.lib and Fluffy.lib in that directory ?
-
MultiWidgets and Fluffy are folders with a lot of .hpp files.
-
If you want to add an include directory you will have to use INCLUDEPATH.
If you want to add binary libraries or import libraries you will have to use LIBS. -
INCLUDEPATH is for the includes, LIBS get the libraries.
@
INCLUDEPATH += C:/CornerStone/includeLIBS += -LC:/CornerStone/lib
LIBS += -lMultiWidgets -lFluffy
@It's unlikely that the include directory contains the libs.
The directory C:/CornerStone/lib must contain MultiWidgets.lib and Fluff.lib. If not, search for the directories that contain those and add them to the LIBS variable.
And as cincirin already mentioned, leave out the leading slash of the paths.
-
I found de lib folder with Multiwidgets.lib. But the thing is that the files that i need are hpp type, not libs type. And this are in the include folder.
So, how can i add the include folder, that contains the .hpp files that i need? -
[quote author="Steban" date="1325609743"]So, how can i add the include folder, that contains the .hpp files that i need?[/quote]
[quote author="Lukas Geyer" date="1325283449"]If you want to add an include directory you will have to use INCLUDEPATH.[/quote]
-
You will most probably need the .hpp files and the .lib files. Without the first, your compilation fails, without the latter the linking fails.
Some hints and a complete example have been given, you're supposed to adapt them to your needs.