View Full Version : Include file problems!!!
12-05-2002, 04:03 PM
This is a really stupid question but it is really pissing me off and I don't know how to fix it. This is the first time I've ever tried to build an OpenGL project with multiple files (usually I just stuck to using one file which was quite messy-which is why I'm trying to use multiple files now). Anyways, my problem is that in my Main.cpp file (where WinMain and everything else starts up) I make sure to include all the necessarry OpenGL files before any of my user-defined include files, however, VC++ is giving me no end of errors regarding the fact that in my user-defined files it can't recognize the OpenGL functions I am using, in other words, the OpenGL functions aren't being "included" before my files are, however, they obviously are being included in main long before my files are. I hope that makes some kind of sense!! Please help me!!!!
12-05-2002, 05:25 PM
Well from what you say, it is probably a simple matter of not linking the libraries to your project Add the following lines to the top of your code and your set to go
// Link the libaries manually
// This can be done through going through the menus on the IDEs, but this way is cooler http://www.opengl.org/discussion_boards/ubb/biggrin.gif and i don't have to worry about telling you where to go (it's different on different versions). This code works for any of the versions (it is C after all)
#pragma comment (lib, "opengl32")
#pragma comment (lib, "glu32")
#pragma comment (lib, "glaux")
12-06-2002, 01:27 AM
Thanks Halcyon, I tried it but that's not the problem. I already had all the libraries linked in in the IDE, but I tried it anyways and it still didn't work =\ I think it's something else, but I still don't know what! Anyone else wanna try?
12-06-2002, 02:16 AM
if you have source files other than your Main.cpp file that need the opengl headers, then you need to include the appropriate headers from those source files as well.
for example, let's say you have Main.cpp and Texture.cpp, and both files need the opengl headers. then it's not enough to just include the headers in Main.cpp. you also need to include the headers in Texture.cpp.
12-06-2002, 01:22 PM
Hahahahaha!! Thanks SThomas. You just proved that I am a moron!! I thought that I had already tried what you had suggested, but apparently I didn't put the includes in ALL the files I needed, so upon a more careful re-check, I discovered the problem and now it works! Thanks for pointing it out to me =)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.