Linking against NuGet Libraries in Visual Studio 2013

前端 未结 3 874
北荒
北荒 2021-01-18 05:55

Hi: In Visual Studio 2012 Professional, Update 4, I can create a new OpenGL project pretty easily by creating a new Visual C++ project (using the blank template) and going i

3条回答
  •  被撕碎了的回忆
    2021-01-18 06:23

    For static linking:

    #define GLEW_STATIC
    #define FREEGLUT_STATIC
    #include 
    #include 
    

    Project->Properties->Configuration Properties->Referenced Packages->freeglut->Linkage (select static)

    Do the same for Referenced Packages->glew

    Now, in Linker->General->Additional Library Directories:

    $(SolutionDir)\packages\freeglut.2.8.1.15\build\native\lib\v110\Win32\Debug\static;$(SolutionDir)\packages\glew.1.9.0.1\build\native\lib\v110\Win32\Debug\static

    The library versions may change, and the path may change a little, but this is what works for me as of 14-MAY-2015.

    EDIT: you still need to include "glew.lib" in Linker->Input->Additional Dependencies, so, bothering with the Referenced Package settings seems pointless (it works for freeglut, but not glew, and if you have to glew to the Additional Dependencies anyway, might as well just add freeglut, too).

    For dynamic linking, in the Referenced Packages section, select "Dynamic Linking" for freeglut & glew, and either add or replace each package's library directory in the Additional Library Directories setting, and copy the DLL's from the redistributable directory to your Projects output directories, matching the debug DLL to the Debug directory, etc. Also, omit the XXX_STATIC #defines :)

    The dynamic settings are a guess, but I know the static settings work.

提交回复
热议问题