Skip to main content
added 371 characters in body
Source Link
Anton
  • 434
  • 4
  • 9

Your .h file declares the variable glActiveTexture. Even with header guards, this means that when this header is included a new definition of the variable is created. To solve this, define the variable as extern and then define it in a single .cpp file of your choice.

I.e.

// .h file
extern PFNGLACTIVETEXTUREPROC glActiveTexture;

// .cpp file of your choice
PFNGLACTIVETEXTUREPROC glActiveTexture;

This tells the compiler to not create a new definition whenever it reads the header code, but to resolve it when linking. One of your .cpp files then provide this definition explicitly and the linker is happy.

Your .h file declares the variable glActiveTexture. Even with header guards, this means that when this header is included a new definition of the variable is created. To solve this, define the variable as extern and then define it in a single .cpp file of your choice.

Your .h file declares the variable glActiveTexture. Even with header guards, this means that when this header is included a new definition of the variable is created. To solve this, define the variable as extern and then define it in a single .cpp file of your choice.

I.e.

// .h file
extern PFNGLACTIVETEXTUREPROC glActiveTexture;

// .cpp file of your choice
PFNGLACTIVETEXTUREPROC glActiveTexture;

This tells the compiler to not create a new definition whenever it reads the header code, but to resolve it when linking. One of your .cpp files then provide this definition explicitly and the linker is happy.

Source Link
Anton
  • 434
  • 4
  • 9

Your .h file declares the variable glActiveTexture. Even with header guards, this means that when this header is included a new definition of the variable is created. To solve this, define the variable as extern and then define it in a single .cpp file of your choice.