I am trying to compile a c program that includes a header in to .c files. but only 1 of the .c files is really using the defined variable in the header file. here is some sample code that will generate the linker problem. I am trying to have my header file contain global variables that are used by 2 different .c files... Any kind of help would be appreciated. thanks.
tmp1.h file
#ifndef TMP1_H_1
#define TMP1_H_1
double xxx[3] = {1.0,2.0,3.0};
#endif
tmp1.c file
#include "tmp1.h"
void testing()
{
int x = 0;
x++;
xxx[1] = 8.0;
}
main1.c file
#include <stdio.h>
#include "tmp1.h"
int main()
{
printf("hello world\n");
}