Wednesday, May 6, 2009

cygwin shell syntax error near unexpected token

This is a common error and the reason is your are using Windows to create the file. Thus the line break is \r\n rather than \n.

All you need to do is change the format using a system command:

dos2unix filename_here

7 comments:

Anonymous said...

Don't know why but it works now. Thnaks a lot from Spain.
p.d. I have to write it every time when im compiling a program?

Anonymous said...

I am getting a syntax error near unexpected token '$'\r''

And I do not see the error can you help me out.

#include
main()
{

int iNumber = 30;
int *iPtr = NULL;

iPtr = &iNumber;

printf("\n*iPtr = %p\n", iPtr, &iNumber);
printf("\nThe value is: %d\n", iPtr, iNumber);
}

Anonymous said...

I figured it out.

Muffin said...

I am stumped I have errors on line 12,13,17,18,19. Could you give me a clue at what I have done wrong?

#include

int cPtr(char []);
int cCharacter(char []);

main()
{

const int iNumber = 30;
int *iPtr = NULL;
const int fFloat = 3.123456;
int *fNumber = 0.0;
const char *cPtr[] = 'A';



*iPtr = &iNumber;
*fFloat = &fNumber;
*cPtr = &cCharacter;

printf("\nThe Value of iNumber: %d\n", iPtr, &iNumber);
printf("\nThe Address of *iPtr = %p\n", iPtr, &iNumber);

printf("\nThe Value of fNumber: %d\n", fFloat, &fNumber);
printf("\nThe Address of *fFloat = %p\n", fFloat, &fNumber);

printf("\nThe Value of cCharacter: %c\n", cPtr, &cCharacter);
printf("\nThe Address of cPtr = %p\n", cPtr, &cCharacter);


}

navya said...

Great Article
C# Training in Chennai | C# Online Training | ASP.NET Training in Chennai

C# Training in Chennai | Dot Net Training in Chennai | Dot Net Training in Chennai

navya said...

Great Article
C# Training in Chennai | C# Online Training | ASP.NET Training in Chennai

C# Training in Chennai | Dot Net Training in Chennai | Dot Net Training in Chennai

nikitha josh said...

Very interesting post! Thanks for sharing your experience suggestions.
Aviation Courses in Chennai
air hostess academy in Chennai
Airport Management Training in Chennai
airport ground staff training in Chennai
Aviation Academy in Chennai
air hostess training in Chennai
airport management courses in Chennai
ground staff training in Chennai