my program has multiple .cpp files. in each one, i want to include each of my multiple .h files. but for certain header files, when they are including more than once, i get a linking error, "function already defined in something.obj". Now, i could understand this normally, but in each header file, i've added the code to prevent redefinitions.
Code:
#ifndef cBenH
#define cBenH
...
...
...
#endif
here is the controversial header file.
Code:
#ifndef hListH
#define hListH
#include <windows.h>
//Function prototypes
void Notify(HWND,LPCTSTR);
void Notify(HWND,long int);
//Functions
void Notify(HWND hwnd,LPCTSTR str)
{
MessageBox(hwnd,str,"Notification",MB_OK);
return;
}
void Notify(HWND hwnd,long int num)
{
char *chTemp;
chTemp=(char *)malloc(11);
ltoa(num,chTemp,10);
Notify(hwnd,chTemp);
free(chTemp);
return;
}
#endif
why is the code being processed more than once?