小编Mou*_*oss的帖子

win32程序在GCC编译但不是G ++ HDC错误

我有一个简单的win32程序用于基本的opengl绘图.它将使用gcc编译,但如果我使用g ++它会给我错误:

minimal.c: In function 'HWND__* CreateOpenGLWindow(char*, int, int, int, int, BYTE, DWORD)':
minimal.c:130:24: error: cannot convert 'HDC {aka HDC__*}' to 'HWND {aka HWND__*}' for argument '1' to 'int ReleaseDC(HWND, HDC)'
     ReleaseDC(hDC, hWnd);
                        ^
minimal.c: In function 'int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)':
minimal.c:160:24: error: cannot convert 'HDC {aka HDC__*}' to 'HWND {aka HWND__*}' for argument '1' to 'int ReleaseDC(HWND, HDC)'
     ReleaseDC(hDC, hWnd);
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它会用gcc编译但是当我使用g ++时会失败?

这是代码:

#include <windows.h>            /* must include this before GL/gl.h */
#include <GL/gl.h>          /* OpenGL header file …
Run Code Online (Sandbox Code Playgroud)

c c++ winapi

0
推荐指数
1
解决办法
117
查看次数

标签 统计

c ×1

c++ ×1

winapi ×1