Schulp
Schulp

Reputation: 73

How to add a library in Qt Creator without .lib or .dll file

I'm trying to add a external library into my project in Qt Creator. Usually I am supposed to add the .dll, .lib or .a file (I am using Windows) when right-clicking my project > add library but in my case, there is no such file in the folder. Am I just blind and I keep overseeing it or do I have to create the file on my own or something like that? I would appreciate if there's a detailed solution for my problem.

Upvotes: 3

Views: 1547

Answers (2)

Landstalker
Landstalker

Reputation: 1368

1- Download and Install CMake Here
2- Download your project sources Here
3- Extract your project to a source folder (Exemple : G:\Cmake\Sources\ArduinoJson-6.x)
4- Run Cmake
5- Indicate the path of your project and where you want to generate your project for a later compilation of lib, dll

enter image description here

6- Click on Configure
7- Choose your IDE cible (Visual Studio 2010 in my case)
enter image description here

8- Click on Generate

enter image description here
9- Open your VC solution ("G:\Cmake\Build\ArduinoJson.sln")
10- Compile your project to get Libraries

enter image description here

Upvotes: 0

Fareanor
Fareanor

Reputation: 6805

As already mentioned in comments, this is a header-only library.

You have a ArduinoJson.h file in the root of the repository that seems to include the whole library. You just have to #include it where needed and that should work.

If you don't want to #include with the full path, you can set the INCLUDEPATH variable in your .pro file (details here).

For example:

.pro

INCLUDEPATH += path/to/ArduinoJson/

implementation

#include <ArduinoJson.h>

Upvotes: 4

Related Questions