How can I fix this error expected declaration of specifiers

How can I fix this error: expected declaration of specifiers or \'...\' before string constant %} when I try to run gcc on a created file from flex? The command I\'m using is gcc lex.yy.c test.bc -o output.

lex..yy.c is the flex file I\'ve created using flex in Windows 7

Solution

Please follow the data and description :

For the above given code it is to be noted that the data or some lines of code have been placed outside the main function and that are not inside any function rather than main. But in the langauge if C the code needs to be part of a function or its implementations to run successfully and to be called if needed.

In the above program the lines are after the decalration of the library files are out of the main function namely the basic \"printf\" statement which needs to be inside a function. So try replacing the data that is outside a main function to a new function and that call it in the main function to run the caode.

Hope this is helpful.

How can I fix this error: expected declaration of specifiers or \'...\' before string constant %} when I try to run gcc on a created file from flex? The command

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site