# syntax



## sossego (Apr 14, 2009)

```
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.


----------



## graudeejs (Apr 14, 2009)

show source


----------



## SirDice (Apr 14, 2009)

man 3 printf


----------



## sossego (Apr 14, 2009)

```
#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.


----------



## adamk (Apr 14, 2009)

Look at the include line...  You have an extra space in there.

Adam


----------



## sossego (Apr 14, 2009)

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?


----------



## SirDice (Apr 14, 2009)

No, your #include line should read:

```
#include <stdio.h>
```

There's a space in yours..

stdio.h lives in /usr/include:

```
dice@williscorto:~>ll /usr/include/stdio.h
-r--r--r--  1 root  wheel  14752 Apr 25  2008 /usr/include/stdio.h
```


----------



## SirDice (Apr 14, 2009)

Works like a charm:

```
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 (Apr 14, 2009)

Minha culpa (My fault). Thanks for showing me that.


----------



## SeanC (Apr 14, 2009)

sossego said:
			
		

> ```
> 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]
> ...


----------



## SeanC (Apr 14, 2009)

Also, maybe use an IDE with syntax highlighting.


----------



## LateNiteTV (Apr 14, 2009)

i used to use codelite for a c ide. pretty good. 
/usr/ports/editors/codelite


----------

