Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Blending OpenGL and MFC

  1. #1
    Intern Newbie
    Join Date
    Jul 2002
    Posts
    45

    Blending OpenGL and MFC

    Yes, I know there is another thread about this topic, but my question is different, and the replies to that post didn't help me.
    I have written some opengl code that works, and now I am trying to combine a program someone else wrote into my code. The person wrote a command line program that uses MFC(I think for the sole purpose of using CStrings, but maybe there are some other things in there I missed when I skimmed over it). When I try and compile my program with his stuff included, I get the following error:
    fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

    So I comment out the #include <windows.h> in my opengl code, and then I get 3 errors that read:
    include\gl\gl.h(2301) : error C2144: syntax error : missing ';' before type 'void'

    \include\gl\gl.h(2301) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers

    \include\gl\gl.h(2301) : fatal error C1004: unexpected end of file found

    Does anyone know why this is happening, and what I can do about it? Any help would be appreciated. TIA

    -Drew

  2. #2

    Re: Blending OpenGL and MFC

    Without looking at your code it is difficult to tell what is wrong exactly but try using the MFC header, afxwin.h, instead and before any other headers.

    #include <afxwin.h> // MFC Windows include file
    #include <GL/gl.h> // OpenGL include file
    #include <GL/glu.h> // OpenGL Utilities include file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •