M
Madhur
I have problems faced in adding definitions in the command header
file. I have defined a header file which includes huge set of global
constants and I am using them in all the C files.
For example my sample.h file looks like this
/*************
File : sample.h
****************/
const int a1 = 0;
const int a2 = 0;
/****End of sample.h*********/
My source code looks like this
/*****************
File:sample1.c
***********/
#include "sample.h"
int main()
{
}
/*****End of sample1.c************/
/***************
File : sample2.c
**************/
#include "sample.h
int main()
{
}
/*******End of sample2.c**********/
Now the problem is during linking it says multiple definition of
symbols a1 and a2. I can avoid this problem by having a C file which
contains the definitions and H file for declarations. But is there any
way I can avoid doing this. Please let me know.
file. I have defined a header file which includes huge set of global
constants and I am using them in all the C files.
For example my sample.h file looks like this
/*************
File : sample.h
****************/
const int a1 = 0;
const int a2 = 0;
/****End of sample.h*********/
My source code looks like this
/*****************
File:sample1.c
***********/
#include "sample.h"
int main()
{
}
/*****End of sample1.c************/
/***************
File : sample2.c
**************/
#include "sample.h
int main()
{
}
/*******End of sample2.c**********/
Now the problem is during linking it says multiple definition of
symbols a1 and a2. I can avoid this problem by having a C file which
contains the definitions and H file for declarations. But is there any
way I can avoid doing this. Please let me know.