0

This tutorial, after the whole CMake build thing which I have done but not necessarily understand why its like that, it says the following:

Once we generated the library we need to make sure the IDE knows where to find the library and the include files for our OpenGL program. There are two common approaches in doing this:

  1. We find the /lib and /include folders of the IDE/compiler and add the content of GLFW's include folder to the IDE's /include folder and similarly add glfw3.lib to the IDE's /lib folder. This works, but it's is not the recommended approach. It's hard to keep track of your library and include files and a new installation of your IDE/compiler results in you having to do this process all over again.

  2. Another approach (and recommended) is to create a new set of directories at a location of your choice that contains all the header files/libraries from third party libraries to which you can refer to from your IDE/compiler. You could, for instance, create a single folder that contains a Libs and Include folder where we store all our library and header files respectively for OpenGL projects. Now all the third party libraries are organized within a single location (that can be shared across multiple computers). The requirement is, however, that each time we create a new project we have to tell the IDE where to find those directories.

Now I don't exactly understand either methods and how I would go about this. I wanted to try the recommended approach. What would be the best location for these 'Directory' folder, and which of the elements of 'glfw-3.3.2' folder would I put here? And how would I know how to tell the IDE where to find those directories? Is there any single easy-to understand place to get this information on how to properly manage this? I am working with visual studio 2017 community.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Papbad
  • 163
  • 2
  • 13
  • ***What would be the best location for these 'Directory' folder*** This is more of a user preference. For me I structure my folders in a hierarchy. And do this in drive that contains only programming. – drescherjm Jan 25 '20 at 16:40
  • Related if not a duplicate: [https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project](https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project) – drescherjm Jan 25 '20 at 16:44
  • 1
    The linked tutorial explains every step you need to take to link with the libraries. Just keep reading. – Lukas-T Jan 25 '20 at 16:46
  • @churill I tried to follow it. It has the what to do for the include folder but then it says 'The same applies for the library directories.' I tried to look for something with .lib in glfw-3.3.2 folder but I don't find anything like that? – Papbad Jan 25 '20 at 16:56
  • The lib should be in the build folder you created and compiled using Visual Studio. Did you open and compile the solution in build folder? – drescherjm Jan 25 '20 at 16:57
  • @drescherjm I got a bunch of vcsproj files, cmake files, and folders such as CMakeFiles, example, src, tests in my build folder. There is no .lib files anywhere? – Papbad Jan 25 '20 at 17:00
  • Did you open that project in Visual Studio and build it? In this case `CMake` is generating `Visual Studio` project files that you need to build. – drescherjm Jan 25 '20 at 17:00
  • 2
    In this step: ***Since CMake generated a project file that already contains the proper configuration settings we only have to build the solution.*** you need to open the VS project and build it for all configurations. – drescherjm Jan 25 '20 at 17:04

0 Answers0