Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm an absolute beginner at writing programs in C, and I'm having difficulty compiling a simple program. Here's my code:

/* This code is a .c file that prints out the words hello, world. */

# include <stdio.h>
int main()
{
    printf("Hello World! \n");
}

Here's the error I get when compiling:

Ubuntu:~/Desktop/cFiles$ gcc -Wall hello.c -o hello.out -lmls 
hello.c:5:1: warning: return type defaults to ‘int’ [-Wreturn-type]
hello.c: In function ‘main’:
hello.c:7:3: warning: implicit declaration of function ‘print’ [-Wimplicit-function-declaration]
hello.c:8:1: warning: control reaches end of non-void function [-Wreturn-type] /usr/bin/ld: cannot find -lmls
collect2: ld returned 1 exit status

I'm not sure what I'm doing wrong. Can anyone help?

share|improve this question
I have corrected your code formatting for you. – saji89 Jan 19 at 5:50
Welcome to Ask Ubuntu! Please remember to format your post properly. This assures you have a high quality questions, which will receive the high quality answers it deserves! Thanks and good luck! – Mochan Jan 19 at 6:07

1 Answer

Seems like you have an unwanted space between # and include:

# include <stdio.h>   

Make that

#include <stdio.h> 

and compile.
That should solve it for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.