summaryrefslogtreecommitdiff
path: root/reference/C/compiler.html
blob: ad6f3d8c04aab5c35792528de14d31aead4d574b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<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>