Reputation: 553
How Can I add glew32.dll to visual Studios 2010 without having to put it in system root direction.
I followed a few online examples of adding glew32.dll all come to the same answer to just put it in the system root.
But just for studies sake.
Is there a way to include glew32.dll to Visual Studios 2010 without having to put it in the system root directory.
If you have an answer reply with an example of how to do so.
Upvotes: 2
Views: 4072
Reputation: 162164
Is there a way to include glew32.dll to Visual Studios 2010 without having to put it in the system root directory.
Don't think of it as something you want to add to VS. Instead think of it as an asset of the program you're building: Just copy the DLL into the same folder of the EXE of your program. Windows will look there first for DLLs before it even goes looking for it in the system directories.
Of course GLEW is so small, that it probably is the better choice so simply link it statically.
Upvotes: 2
Reputation: 43319
Ordinarily I would not "answer" something this way, but there really are next to no benefits to using the DLL version of glew. It is not like you can pop a new version of this DLL in and take advantage of new features, you have to know about the extensions at the time you compiled your software originally.
To avoid having to ship glew32.dll
with your software you can link to glew32s.lib
. Your .exe will grow in size, but not substantially and you probably would have had to ship glew32.dll
anyway so the difference in size is moot.
#pragma
for MSVC's compiler:#define GLEW_STATIC // This must be defined when statically linking to GLEW
#include "glew.h"
#pragma comment (lib, "glew32s.lib") // Link to glew32s.lib
Alternatively, you can setup libraries in your project settings, but that involves going through the MSVC GUI and I do not have a copy of Visual Studio 2010 to show you how that is done.
Upvotes: 3