Error Syntax Error Before Return
Contents |
more stuff so I started looking at SDL. I error syntax error before token installed SDL no problem, but when I tried to follow this (http://pgdc.purdue.org/sdltutorial/01/) tutorial on SDL basics, the output
Syntax Error Before Token Dev C++
from Visual Studio 2008 was:1
2
3
4
1>c:\sdl_test\sdl_test\sdl2\main.cpp(122) : error C2059: syntax error : 'return' 1>c:\sdl_test\sdl_test\sdl2\main.cpp(123) : error C2059: syntax error : '}' 1>c:\sdl_test\sdl_test\sdl2\main.cpp(123) : error C2143: syntax error : missing ';' before '}' 1>c:\sdl_test\sdl_test\sdl2\main.cpp(123) : error C2059: syntax erlang syntax error before error : '}' The code I ended up with was: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
/* -- Include the precompiled libraries -- */ #ifdef WIN32 #pragma comment(lib, "SDL.lib") #pragma comment(lib, "SDLmain.lib") #endif #include
parse error at..., parse error before... This is a general-purpose syntax error. It is frequently caused by a missing
Parse Error Before
semicolon. For example, the following code: #include
Parse Error Before Token
shorten example, not using argp */ int main() { printf ("Hello, world!\n") return 0; } what is a parse error in c generates the following error: semicolon.c: In function `main': semicolon.c:6: parse error before `return' Adding a semicolon (;) at the end of the line printf ("Hello, http://www.cplusplus.com/forum/beginner/3294/ world!") will get rid of this error. Notice that the error refers to line 6, but the error is actually on the previous line. This is quite common. Since C compilers are lenient about where you place whitespace, the compiler treats line 5 and line 6 as a single http://crasseux.com/books/ctutorial/parse-error-at....html line that reads as follows: printf ("Hello, world!\n") return 0; Of course this code makes no sense, and that is why the compiler complains. Often a missing curly bracket will cause one of these errors. For example, the following code: #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of http://stackoverflow.com/questions/9873366/syntax-error-before-token this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question http://stackoverflow.com/questions/1793971/why-does-gcc-give-me-a-syntax-error-when-trying-to-return-a-struct-pointer x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax syntax error error before '*' token up vote 0 down vote favorite int main() { return 0; } const uint8_t* byteHunter(const uint8_t *Search, uint16_t sLength, const uint8_t *Pattern, uint16_t pLength) { // This is the body of the function } I get an error when compiling this function interface that says: 19 C:\Users\Anne\Documents\School\Sophomore\Spring2012\CS 2505\HW09.c syntax error before '*' token Besides comments above the function interface, syntax error before there is nothing else in my code at all. What am I doing wrong? c syntax share|improve this question edited Mar 26 '12 at 13:50 Igor 16k114686 asked Mar 26 '12 at 13:49 Anne Lee 577 2 #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why does GCC give me a syntax error when trying to return a struct pointer? up vote 3 down vote favorite I'm using CodeLite on Ubuntu and for some bizzare reason GCC keeps throwing this error whenever I try to compile code with a function that returns a pointer to a struct: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token Here is an example I wrote up to demonstrate this error: #include