Library from github

Dec 19, 2017 at 9:07pm
I have a library of files from github and I need to use the classes that have been defined in this library in my code written in Visual Studio's C++. How do I do this? Should I simply copy the files from the repository and paste the files into the 'Include' folder in C:\Program Files\Microsoft Visual Studio\...\include?
Dec 19, 2017 at 10:28pm
Well, you could possibly do it that way if all else fails, but in the general case, no, you wouldn't want to do it that way. Unless it's a library that's all headers, for example, GLM (OpenGL Mathematics), or a library with very minimal files (I used a simple .h and .cpp file to compile a simple version of the FFT before I took the time to install fftw3).

If you only need to include header files (no .cpp files), you can go to:
In Configuration Properties > C/C++ > General > Additional Include Directories, enter the path to the [for example, Boost library] root directory, for example:
C:\Program Files\boost\boost_1_55_0


If it's not a header-only library, you need to create .lib files that you then link your code to.
https://stackoverflow.com/questions/1322473/creating-lib-file-in-visual-studio

Here's Microsoft's guide to C++ libraries:
https://msdn.microsoft.com/en-us/library/ms235627.aspx (Static library)
https://msdn.microsoft.com/en-us/library/ms235636.aspx (Dynamic library (uses DLLs))

I usually work with gcc and not Visual Studio, but depending on how popular your library is, there might be a pre-made VS library project that you can build the solution for.
Topic archived. No new replies allowed.