Sign in to follow this  
MStanhope

Getting executables to run on all PCs (glut32.dll missing)

Recommended Posts

Hi guys, I've written some C++ code to render a cube, not very fancy but I'm new to this. It builds and runs on my PC and the exe runs on my friend's PC too (I assume he has glut32.dll). However, the exe doesn't run on the PCs in my university (This applicationhas failed to start because glut32.dll was not found. Re-installing the application may fix this problem). I assume this is because I haven't put glut32.dll in the system32 folder but the problem is, I don't have access to that folder in university. So basically, is there a way that I can get around this problem? Instead of plonking glut.h, glut32.lib and glut32.dll in the usual folders on my pc, can i put them all in my project somehow? Thanks in advance, I hope this question isn't too trivial, I've been googling for some time and haven't really got anywhere.

Share this post


Link to post
Share on other sites
Wow... I'm an idiot...

Thanks! Just one more question? Can I put glut32.lib in the project file, rather than in the visual studio library file?

Share this post


Link to post
Share on other sites
I'm not sure what you mean with that last question, but from the sound of it what you want is to link your executable statically instead of dynamically, which would mean there's no need to copy DLLs along with it to different machines. Basically every method your program uses in glut32.lib would get copied into your executable when you compile it, and the loader wouldn't have to look it up in glut32.dll at run-time. This would make your executable slightly bigger (since the methods need to be somewhere, one way or another) but would make it virtually stand-alone.

I'm pretty sure this can be done with Visual Studio, but as I've never done any Windows development I'm afraid I can't tell you how to do it. Look around for stuff that sounds similar to "static" or "stand-alone" and has to do with the linker :)

Share this post


Link to post
Share on other sites
Thanks, you're correct in thinking that I basically want a stand-alone executable.

I'll have a look at the options in visual studio and google static linking.

I'll update this thread if I get it sorted incase any other newbies are having the same problem.

Share this post


Link to post
Share on other sites
Well, I tried all last night to find a way to create a truly stand alone exe in vc++ but to no avail. I really must be mssing a trick here, I just want a way toc compile my program so that I don't need glut32.dll in the same directory all the time.

Any ideas?

Share this post


Link to post
Share on other sites
Use the Win32 API. It's not difficult (lots of tutorials on the web).

or another library such as glfw:
http://glfw.sourceforge.net/

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