Node:unterminated string or character constant, Previous:undefined reference to..., Up:Compile-time errors



unterminated string or character constant

This error is often generated by code like the following:

#include <stdio.h>

/* To shorten example, not using argp */
int main()
{
  printf("hello!\n);
  printf("Hello again!\n");
  return 0;
}

The actual error message received was:

missquotes.c:6: unterminated string or character constant
missquotes.c:5: possible real start of unterminated constant

The compiler never found a close quote (") for the string Hello!\n. It read all the text up from the quote in the line printf("Hello!\n); to the first quote in the line printf("Hello again!\n"); as a single string. Notice that GCC helpfully suggests that it is line 5 that actually contains the unterminated string. GCC is pretty smart as C compilers go.