I am getting linker errors that suggest I am not using #ifndef and #define.
1>TGALoader.obj : error LNK2005: "struct TGA tga" (?tga@@3UTGA@@A) already defined in main.obj 1>TGALoader.obj : error LNK2005: "struct TGAHeader tgaheader" (?tgaheader@@3UTGAHeader@@A) already defined in main.obj 1>TGALoader.obj : error LNK2005: "unsigned char * uTGAcompare" (?uTGAcompare@@3PAEA) already defined in main.obj 1>TGALoader.obj : error LNK2005: "unsigned char * cTGAcompare" (?cTGAcompare@@3PAEA) already defined in main.obj 1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
I have included a header file Texture.h and tga.h from the nehe opengl tutorials into my project. I have
#ifndef TGAISCOOL
#define TGAISCOOL
#endif
in my tga.h file. If I include this more than once, I get the errors from the linker that I pasted above. The first two are from texture.h though the situation is the same.
Any ideas on what is wrong?