Throw me a bone here.... hello world in c...

So what do I need to do to get the most basic c program to output anything?

#include<stdio.h>
int main()
{
printf(“hello world”);
}

compile with gcc

output: nada, nowt, zilch…

This thing sure has a steep learning curve…

(running Angstrom)

First, you need to SSH to your board and login as root.

  1. Once you’re in the terminal, type in $ nano example.c
  2. Copy down this sample code and save.

#include <stdio.h>
int main(void){
printf(“Hello World\n”);
return 0;
}
3) In the terminal, type $ g++ example.c -o example
4) Finally, type ./example
5) You should see an output of “Hello World” on your screen.

Once compiled, you should have an executable file (a.out unless you change it with the -o option to gcc). Type in “./a.out” and press enter, and it should give you the output you’re looking for.

Lets suppose you have a file called hello.c

Just me being daft…

I used a file name called test,

test is obviously used elsewhere for something and whatever it does, nothing is returned to the console.

./test actually runs my program, which works perfectly of course!!!

Now on to more interesting things…

Thanks for your input, I thought I was going mad!