Results 1 to 5 of 5

Thread: Include file problems!!!

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    4

    Include file problems!!!

    This is a really stupid question but it is really ****ing 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!!!!

  2. #2
    Halcyon
    Guest

    Re: Include file problems!!!

    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

    Code :
    // Link the libaries manually
    // This can be done through going through the menus on the IDEs, but this way is cooler  [img]http://www.opengl.org/discussion_boards/ubb/biggrin.gif[/img] 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")

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    4

    Re: Include file problems!!!

    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?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jun 2002
    Location
    Philadelphia, PA, US
    Posts
    108

    Re: Include file problems!!!

    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.

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    4

    Re: Include file problems!!!

    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 =)

Similar Threads

  1. opencl API : include headers to .cl file
    By opencl_JEDI in forum OpenCL
    Replies: 6
    Last Post: 03-11-2010, 01:11 AM
  2. include headers to .cl file
    By opencl_JEDI in forum OpenCL
    Replies: 1
    Last Post: 03-06-2010, 06:33 PM
  3. How to Include Common File into OCL file!
    By alexzhao in forum OpenCL
    Replies: 1
    Last Post: 11-09-2009, 12:23 AM
  4. cannot include glut.h file
    By namelb in forum OpenGL: Windows
    Replies: 2
    Last Post: 02-20-2004, 03:50 PM
  5. cant open include file? 'GL/glut.h'
    By [TheFORCE] in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 11-14-2003, 03:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean