Sign in to follow this  
Nokobon

Problem installing glew on Windows 7 64Bit with VS2010

Recommended Posts

Hi,

for hours now I am trying to use glew on Windows 7 with Visual Studio 2010.

That's what I did:
1. downloaded the glew binaries
2. added the glew Include-Directory to my project
3. added the glew lib directory to Library Directories of my project
4. added glew32.lib to aditional dependencies
5. copied glew32.dll to Windows/System32

I tried to compile this source code:
[code]
#include <GL\glew.h>
#include <cstdlib>

int main() {
if (GLEW_OK != glewInit())
exit(1);
return 0;
}
[/code]

On my 32Bit system I have no problems, but using Windows 7 64Bit I get the following Linking Errors:
[code]
error LNK2019: unresolved external symbol __imp__glewInit referenced in function _main
error LNK1120: 1 unresolved externals
[/code]

Any idea what's wrong?

Thanks in advance,
Nokobon

Share this post


Link to post
Share on other sites
Sounds like the link can't find your .lib file.

Are you sure you need to put that in added glew32.lib to aditional dependencies.
There should be a section for .lib files.

Are you building a 32 bit project or 64 bit?

Share this post


Link to post
Share on other sites
Yes, you are right the Linker can't find the .lib file.
I definitely need to add it to "additional dependencies".
But although I gave the library path (where glew32.lib is in), it cannot be found.

That problem appears when using VS2010 64bit and Windows 7 64bit.
On Windows7 32bit with VS2010 32bit it works properly.

Could there be a problem with the glew32.lib file for 64bit systems?

Share this post


Link to post
Share on other sites
I suppose you can compile glew and target the 64 bit platform and you'll have a 64 bit .lib and .dll

Share this post


Link to post
Share on other sites
Side note;

[quote name='Nokobon' timestamp='1311253814' post='4838422']
5. copied glew32.dll to Windows/System32
[/quote]

While it is fine to do this on your development system you should NEVER do this for a released version.

Placing files in the System32 path isn't the correct way to do it, instead place the dll with your exe file, this will avoid versioning conflicts and the like.

Share this post


Link to post
Share on other sites
I figured out that it works when using the glew 32 Bit version on my 64 Bit system. So I don't need to compile it by myself.
But why? Does that mean, although I'm using 64 bit Windows and 64 bit visual sudio it does build for bit?

And thanks for the tip regarding the .dll file.
But linking to the .lib file this way I don't really need the .dll, don't I?

Share this post


Link to post
Share on other sites
By default Visual Studio builds 32bit applications, you have to create a 64bit config in your project for it to work.

Visual Studio is a 32bit program btw, they haven't made a 64bit version yet.

As for the lib/dll question; if you create a 'library' project which only produces a lib file then you won't need a dll.

However if the project is a dll one and produces a lib and dll file then you need to link to the lib file AND supply the dll as the lib is just a stub which is used to link the dll into the application at runtime.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this