extern

y is it giving an error...i hv declared it an extern variable then y does it say C:\Users\Mehak\Desktop\Untitled1.o:Untitled1.c|| undefined reference to `i'|
C:\Users\Mehak\Desktop\Untitled1.o:Untitled1.c|| undefined reference to `i'|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|


1
2
3
4
5
6
7
8
#include <stdio.h>
int main()
{
    extern int i;
    i=10;
    printf("%d",i);
}
Last edited on
Because you've said i exists in another translation unit, but you have no other translation unit defining i.

Where do you think i is defined?
Topic archived. No new replies allowed.