Linking against NuGet Libraries in Visual Studio 2013

前端 未结 3 875
北荒
北荒 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 <GL/glew.h>
    #include <GL/freeglut.h>
    

    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.

    0 讨论(0)
  • 2021-01-18 06:24

    I have same problem, after Install-Package freeglut

    Then I try to install another package: Install-Package nupengl.core

    It works

    0 讨论(0)
  • 2021-01-18 06:36

    What solved the linkerror for me was going to properties->linker->input->additional dependencies and added opengl32.lib.

    You also need to make sure that the freeglut.dll/glew32.dll/glfw3.dll are in the same folder as your executable. This is what install-package nupengl.core does for you.

    0 讨论(0)
提交回复
热议问题