Re: modifying gcc files and getting error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I am trying to change some source files in the GCC compiler and
> getting a compilation error.
>
> In the file "gimple.h", I am adding
>
> extern int  x; // the x is global and  should be accesable from other
> files as well.
>
>
> Then I called x in the "tree_into_ssa.c". However, when I compile the
> gcc compiler using the make command I get the following massage:
>
> undefined refernce to "x".
>
>
> Any comments???

First, this is really a general programming question, and this mailing
list is more for gcc-specific issues. In future, try a general
programming forum like at
http://www.linuxquestions.org/questions/programming-9/.

This error occurs because "extern int x" declares a variable called x,
but does not define it - you need to define it (exactly once) with
"int x" in a source file that will be linked in with whatever source
files you want to use it in. If you don't know the difference between
declaring and defining a variable, I suggest you get a good C book and
have a thorough read.

John G


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux