请教vc下opengl编程配置时
书上说要把下面这段代码加到stdafx.h里 ,
       //OpenGL Headers
        #include <gl\gl.h>         //OpenGL Main Library Header
        #include <gl\glu.h>       //OpenGL Utility Library Header
        #include <gl\glaux.h>    //OpenGL Auxiliary Library Header
        #include <gl\glut.h>      //OpenGL GLUT Library Header
但我插了几次都没插对,请教一下因该插在stdafx.h的哪里?下面是stdafx.h的内容
// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//#if !defined(AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_)
#define AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
       
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_)

解决方案 »

  1.   

    为什么要要加到stdafx里呢?配置的话,把OpenGL32.lib,GLu32.lib,GLaux.lib,GLut.lib加到project->setting->link里。要加到最前面。
      

  2.   

    #if !defined(AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_)
    #define AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers#include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions
    #include <afxdisp.h>        // MFC Automation classes
    #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h> // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT#include <gl\gl.h>         //OpenGL Main Library Header
            #include <gl\glu.h>       //OpenGL Utility Library Header
            #include <gl\glaux.h>    //OpenGL Auxiliary Library Header
    //        #include <gl\glut.h>      //OpenGL GLUT Library Header这个库需要从网络上查找下载//{{AFX_INSERT_LOCATION}}
           
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__576DF056_E403_484B_8942_10CB4DBC1561__INCLUDED_)