This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Explanation to the strange compile time error  RSS feed

 
Rachit Kumar Saxena
Ranch Hand
Posts: 54
  • 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: 54
  • 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
Posts: 55334
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is pretty obvious; the error message says it all.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!