Thread: opengl? "stdafx.h"??

  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    opengl? "stdafx.h"??

    I'm working on the opengl tutorial, but my stystem is unable to find this header?
    where can i get this?
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    stdafx is some piece of junk VC++ automatically creates to "manage" pre-compiled headers.
    It never contains anything worth looking at
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    it is an include file under the opengl tutorial.

    code referenced from link
    Code:
     
    /*	Pre-processor directives*/
    #include "stdafx.h"
    #include <windows.h>
    If it is not valid, then why is it listed in the tutorial?
    I'm confused.

    It does work with out it, so i'm really confused now.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  4. #4
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    Have you tried using #include <stdafx.h>? I might find it there.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Try changing it to
    // #include "stdafx.h"
    Like I said, it's a windows compiler "optimisation" thing.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    stdafx.h is just a pregenerated file that contains commonly used headers. It contains nothing itself apart from other #includes. It's a nice feature when using MFC because you don't have to remember which headers to include, but if I'm not using MFC I usually just remove all references to it.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  7. #7
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    now I'm having (unresolved externals) with the robot program.
    is it posted without a required header?
    i'm assuming from these errors the program is not a self contained program. Do I have to create the prototypes or the entire class? looking at the program it looks like it should work asis due to the functions are declared prior to main. I'm not sure what is wrong. could it be the function calls are passing the wrong type of data? Sorry if these question are remedial, but I've never seen open gl or windows programming before.link
    Last edited by xviddivxoggmp3; 11-08-2003 at 12:39 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Unresolved externals are linker errors, not compiler errors. You most likely need to like the OpenGL libraries.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You also need to link with the opengl library

    How you do this depends on your compiler

    With gcc for example, you would do something like
    gcc prog.c -lopengl

    With an IDE, there's usually a project setting to specify names/locations of additional libraries
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    I've read that this is how you link the library, but I do not have this option on my compiler. I'm using
    Microsoft Visual C++.NET Version 7.0.9466
    Does anybody know how to do this on my compiler.
    After you have created a new Win32 Application (NOT a console application) in Visual C++, you will need to link the OpenGL libraries. In Visual C++ go to Project, Settings, and then click on the LINK tab. Under "Object/Library Modules" at the beginning of the line (before kernel32.lib) add OpenGL32.lib GLu32.lib and GLaux.lib. Once you've done this click on OK. You're now ready to write an OpenGL Windows program.
    details quoted from link

    I created the win32 application, I assumed it needed to be an empty project. When I click on the project menu I get
    (1) add class
    (2) add resource
    (3) add new item
    (4) add existing item
    (4) new folder
    (5) add web reference
    (6) set as startup project
    I feel I'm in the wrong location.
    Last edited by xviddivxoggmp3; 11-09-2003 at 09:44 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  11. #11
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    On VC++ .NET, do the following:

    Go to the solution explorer (the pane that has all your source files listed; use View->Solution Explorer if you don't see it).

    You should see a tree view with your solution. The root of the tree is the solution, and the thing directly under the solution is your project (typically, if your solution contains only one project, it will have the same name as the solution itself).

    Right click on the project, and select the "Properties" option from the menu that pops up.

    In the new window that appears, click on "linker" then "input". Make sure, at the top, you select Configuration: All Configurations. Add your libraries (separated with spaces if there are multiple libraries) to the box saying "Additional Dependencies"
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  12. #12
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    Cat,

    Thanks for the help. I will try it at my next work break.
    I saw that when tinkering, but was unsure what it meant.
    The documentation provided by microsoft for the compiler wasn't clear on how to do it. I'm assuming you are fluent with the MSVC++.NET compiler. Do you have any recommendations on books to read on all the compiler options?
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  13. #13
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    No, I just fought with it until I learned how it worked.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  14. #14
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    !!Cat Rules!!

    Thanks Cat.
    It works.
    You opened a new world of programming for me.
    I feel OpenGL is going to be a fun experience.
    I feel a bit smarter now.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  15. #15
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    As another note, if you need different libraries for different configurations -- for example, if you need a debug version of the library in debug mode, and a release ver in release -- then set the libraries for each configuration separately, of course.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM