Home > Enterprise >  Import C library that hasn't .dll or .lib files inside
Import C library that hasn't .dll or .lib files inside

Time:10-05

So I have two examples of these libraries for printing nice tables. First and second.

I've watched MANY videos on "How to install/include/import a library into your C project" and each one talks about changing Visual Studio solution properties like C/C -> General -> Additional Include Directories, Linker -> General -> Additional Library Directories and finally Linker -> Input -> Additional Dependencies, which should contain paths to .h/.hpp or .dll/.lib files respectively.

So as we can see we don't have any of these files in the two libraries above. Hence the question. How do I work with such libraries in my cpp project? I just need direct instructions or something because I don't think I'll ever understand otherwise. I am trying to install some c library for the first time.

Addition: I don't want to use any package managers.

CodePudding user response:

libfort has a README.md that describes how to integrate it with your project (a step that does not actually require prior compilation, as it is not a "lib" but merely some additional source files to be added to your project directly).

bprinter requires prior compilation / installation, and comes with a CMakeLists.txt configuration to do this. You'll need CMake to do it, but it makes things really simple for you. Check its documentation.


*.dll and *.lib are binary files compiled from the source you check out from a source repository. They are not supposed to be provided from a GitHub repo. Prior to using a compiled library in the way you described (by making the necessary adjustments in your project's VS configuration), you need to compile and install the library according to that project's documentation (as with bprinter).

  • Related