Reputation:
I don't really know what i'm doing wrong. I'm not using a loading library so I can have more control over my code. I am using windows os.
#include <gl/GL.h>
#include <windows.h>
typedef BOOL(WINAPI wglSwapInterval_t) (int interval);
static wglSwapInterval_t* wglSwapInterval;
#ifndef GLAPI
#define GLAPI extern
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#define GL_VERTEX_SHADER 0x8B31
#define GL_FRAGMENT_SHADER 0x8B30
typedef GLuint(APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
PFNGLCREATEPROGRAMPROC glCreateProgram = (PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram");
Error:
(5): error C2086: 'wglSwapInterval_t (__stdcall *__stdcall wglSwapInterval)': redefinition
(5): note: see declaration of 'wglSwapInterval'
(19): error C2374: 'glCreateProgram': redefinition; multiple initialization
(19): note: see declaration of 'glCreateProgram'
Upvotes: 0
Views: 265
Reputation: 29285
Error C2086 says that you have defined wglSwapInterval
multiple times.
Error C2374 says that you have defined and initialized glCreateProgram
multiple times.
The common reason for such problems is including an unguarded .h
file more than once in a single .cpp
file directly or indirectly (i.e. included in another file which itself is included in the current file).
To avoid such problems, always put #ifndef
or #pragma once
in your .h
files as the include guard.
Upvotes: 1