Reputation: 6707
I try to include opengl via nuget.
This is my packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.64.0.0" targetFramework="Native" />
<package id="boost_atomic-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_chrono-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_date_time-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_filesystem-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_log_setup-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_log-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_system-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_thread-vc140" version="1.64.0.0" targetFramework="native" />
<package id="boost_unit_test_framework-vc140" version="1.64.0.0" targetFramework="native" />
<package id="glew.v140" version="1.12.0" targetFramework="native" />
<package id="glfw" version="3.2.1" targetFramework="native" />
<package id="glfw.redist" version="3.2.1" targetFramework="native" />
<package id="GLMathematics" version="0.9.5.4" targetFramework="native" />
<package id="lua" version="5.3.3" targetFramework="native" />
<package id="lua.redist" version="5.3.3" targetFramework="native" />
<package id="nupengl.core" version="0.1.0.1" targetFramework="native" />
<package id="nupengl.core.redist" version="0.1.0.1" targetFramework="native" />
<package id="sdl2" version="2.0.5" targetFramework="native" />
<package id="sdl2.redist" version="2.0.5" targetFramework="native" />
<package id="turtle" version="1.2.6" targetFramework="native" />
<package id="unofficial.flayan.glm" version="0.9.8.4" targetFramework="Native" />
</packages>
It should contain all I need however i am getting an error:
LNK2019: unresolved external symbol __imp__glDrawElements@16
I can "fix" that by including opengl32.lib
.
#pragma comment(lib, "opengl32.lib")
But I wonder if I am missing something in my packages. I was under the impression that one just adds the packages and they include the libraries into the build.
Am I misusing nuget, is there something else I should have done?
Upvotes: 0
Views: 1911
Reputation: 76690
Am I misusing nuget, is there something else I should have done?
No, do not need to do anything else but just including the opengl32.lib
.
glDrawElements
is a "core" OpenGL feature. This function resides in opengl32.dll, which you unfortunately forgot to include in your linking libs.
Besides, Some libraries support auto-linking mechanism (for example, freeglut), that is, the header file contains a line like #prgama comment(lib, "lib1_name.lib").
To resolve that LNK error, just include the opengl32.lib
by the syntax:
#pragma comment(lib, "opengl32.lib")
Upvotes: 2