Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explanation to the strange compile time error

 
Rachit Kumar Saxena
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just as I compiled:

#include<stdio.h>

main()
{
print("hello\cworld");
}

I got this error/output:

warning:unknown escape sequence '\c'

C:\Uers\Abc\Appdata\Local\Temp/ccQLcaaa.o(.txt+ox32):abc.c:undefined reference to 'print'

ld returned 1 exit status.Can anyone of you deduce this error and tell me,in some words,what the compiler wants to say(especially "undefined reference" one)
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first one is pretty obvious. The character '\c' is not recognised as a valid escape sequence. If you actually wanted to include the two characters '\' and 'c' in your string, then you need to escape the '\'. If you intended the '\c' to be an escape sequence, what did you think it meant ?

Don't know on the second one (It's been a while since I did any C programming), but I would guess it might mean it doesn't have a definition for the print method.
 
Rachit Kumar Saxena
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,Thanks for your reply,but the first one the is just a warning,and wanted to know the meaning of the error,that is the second one.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is pretty obvious; the error message says it all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic