syntax

sossego

Retired from the forums
Code:
halpers.c:1:20: error:  stdio.h: No such file or directory
halpers.c: In function 'main':
halpers.c:5: warning: incompatible implicit declaration of built-in function 'printf'
halpers.c:4: warning: return type of 'main' is not 'int'
Text editing files is only getting me so far. So...
is there a practical and updated set of tutorials for c and c++ that can be/ are used for freebsd?
It isn't running or editing c files that causes a problem. it's trying to write them.
 
Code:
#include < stdio.h>

void main()
{
    printf("\n Hello World \n");
}

I know, it's the standard c tutorial; but, I'm not seeing something here.
 
It's the same output after editing. I am looking at a few references that say I may be missing some header/developer files. Question is which ones?
 
No, your #include line should read:
Code:
#include <stdio.h>

There's a space in yours..

stdio.h lives in /usr/include:
Code:
dice@williscorto:~>ll /usr/include/stdio.h
-r--r--r--  1 root  wheel  14752 Apr 25  2008 /usr/include/stdio.h
 
Works like a charm:
Code:
dice@williscorto:~/test>cat test.c
#include <stdio.h>

int main () {
        printf("\nHello World\n");
        return 0;
}

dice@williscorto:~/test>cc -o test test.c
dice@williscorto:~/test>./test

Hello World
dice@williscorto:~/test>
 
sossego said:
Code:
So...
is there a practical and updated set of tutorials for c and c++ that can be/ are used for freebsd?
It isn't running or editing c files that causes a problem. it's trying to write them.[/quote]

Try to get [b]C Primer Plus [/b]by Stephen Prata.  It's more comprehensive than K&R and the author assumes that you have no programming experience.  There are tons of examples, too.
 
Back
Top