modifying gcc files and getting error

John Graham johngavingraham@googlemail.com
Thu Dec 17 09:48:00 GMT 2009


> 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



More information about the Gcc-help mailing list