<title>GCC compiler error messages.</title> <head> <script language="JavaScript"> </script> </head> <body bgcolor="#ffffcc"> <hr> <center> <h1>GCC compiler error messages.</h1> </center> <hr> <p> This is a list of compiler error messages I have hit and the method used to clear them. <p> <hr align="center" width="70%"> <pre>warning: comparison between pointer and integer</pre> Maybe OK. This was generated from 'if (strstr(line,"word") != NULL )' strstr returns NULL or pointers, I was only interested in the fact that a string had been found, not where it was. <p> <hr align="center" width="70%"> <pre>`floppyto.c:782: parse error at end of input</pre> floppyto.c is the program name, 782 is the line number but it is one greater then the file length. This is because of unbalanced {} or unbalanced comments /* */ <p> <hr align="center" width="70%"> <pre>parse error before `printf'</pre> Missing ; before this statement. <p> <hr align="center" width="70%"> <pre>Segmentation error.</pre> You have attempted to access protected storage or overwritten something important! <p> <hr align="center" width="70%"> <pre>subscripted value is neither array nor pointer</pre> Attempted to subscript a scalar variable. <p> <hr align="center" width="70%"> <pre>`j' undeclared (first use this function)</pre> Declare the variable. <p> <hr align="center" width="70%"> <pre>/usr/lib/crt0.o: Undefined symbol _main referenced from text segment</pre> Generated when main() is missing. I have seen this twice. <ol> <li>When there was a syntax error in an included header file. <li>And when the C source file was missing in the gcc command! </ol> <p> <hr align="center" width="70%"> <pre>Undefined symbol _initscr referenced from text segment</pre> Called a function but have not supplied it or the library that contains it with an #include statement. <p> <hr align="center" width="70%"> <pre>unterminated `#if' conditional</pre> <a href=SYNTAX/preprocessors.html>#endif</a> preprocessor required. <p> <hr align="center" width="70%"> <pre>warning: passing arg 1 of `cpystr' makes integer from pointer without a cast </pre> This is the code causing the problem: <pre> void cpystr( char item); main() { char src[]="martin leslie"; cpystr(src); } cpystr(char item) { } </pre> It should be.... <pre> void cpystr( char item[]); main() { char src[]="martin leslie"; cpystr(src); } cpystr(char item[]) { } </pre> <p> <hr align=center width="70%"> <pre> conflicting types for `Alex' previous declaration of `Alex' </pre> <b>Alex</b> has been declared in two <a href="SYNTAX/enum.html">enum</a> statements. Here is the <a href="EXAMPLES/enum3.c">code</a> <p> <hr align="center" width="70%"> <pre> parse error before `1' At top level: warning: data definition has no type or storage class parse error before string constant warning: data definition has no type or storage class </pre> There is a conflict between <a href="SYNTAX/enum.html">enum</a> and <a href="SYNTAX/define_preprocessor.html">#define</a> statements. Here is the <a href="EXAMPLES/enum4.c">code</a> <p> <hr> <p> <center> <table border=2 width="80%" bgcolor="ivory"> <tr align=center> <td width="25%"> <a href="cref.html"> Top</a> </td><td width="25%"> <a href="master_index.html"> Master Index</a> </td><td width="25%"> <a href="SYNTAX/keywords.html"> Keywords</a> </td><td width="25%"> <a href="FUNCTIONS/funcref.htm"> Functions</a> </td> </tr> </table> </center> <p> <hr> <address>Martin Leslie </address><p>