Page 1 of 1

How to include stdio.h for printf?

Posted: Wed May 23, 2012 1:08 am
by MosMax
This should be an easy question to answer. I am extremely new to this. I tried compiling this code for the XC-1, but the compiler had the error can't open include file "stdio.h".

Thanks!

Code: Select all

# include < stdio .h >

main ( void ) {
   printf ( " Hello , world !\ n " );
}
Fixed it!. The problem was the spaces. It should be

Code: Select all

#include <stdio.h>
main ( void ) {
printf ("Hello , world !\n");
}

Re: How to include stdio.h for printf?

Posted: Wed May 23, 2012 9:25 am
by phalt
For a lot of these types of questions, especially common ones related to C, you can google the answers or check on stackoverflow

Re: How to include stdio.h for printf?

Posted: Thu May 31, 2012 1:16 am
by rp181
Also, it should be noted almost all examples in the pdf documentation will not copy-paste correctly. It's easier to re-type the examples.