how do i avoid this linking error ?
Posted
by Yogesh
on Stack Overflow
See other posts from Stack Overflow
or by Yogesh
Published on 2010-05-26T06:50:30Z
Indexed on
2010/05/26
7:01 UTC
Read the original article
Hit count: 161
Filed under:
c
if i have defined a global variable(with initialization) in header file, and included this file in two file and try to compile and link, compiler gives linking error
-----------------
>>headers.h
#ifndef __HEADERS
#define __HEADERS
int x = 10;
#endif
>>1.c
#include "headers.h"
main ()
{
}
---------------------
>>2.c
#include "headers.h"
fun () {}
© Stack Overflow or respective owner