Aros/Developer/Docs/Examples/HelloWorld
From Wikibooks, the open-content textbooks collection
| Navbar for the Aros wikibook
|
| Aros User Docs |
| Aros User FAQs |
| Aros Developer Docs |
| Aros Developer BuildSystem |
| The Zune IDE |
| Zune for beginners |
| Aros Developer - Hello World |
| Specific platforms |
| Aros 68k Support |
| Aros PPC Support |
| Aros *nix Installing |
| Aros *nix Support |
| Aros x86 Installing |
| Aros x86 Support |
| misc |
| Aros on wikipedia |
| Aros Public License |
Contents |
[edit] Description
This is an example 'Hello World' program to demonstrate the basics of using c under AROS
[edit] The Code
#include <stdio.h>
int main(void)
{
puts("Hello, world!");
return 0;
}
Save this as a plain text file named 'helloworld.c'. Inside AROS you can do this by opening a shell (e.g. hit RightAROSKey* + w in Wanderer), typing 'edit helloworld.c', entering the code above, hit RightAROSKey + w to save it, hit RightAROSKey + q to quit editing.
(*on most keyboards RightAROSKey is the Windows key on the right side)
[edit] Making It Compile
If you've created 'helloworld.c' inside AROS, compile it with:
gcc -o helloworld helloworld.c
To cross-compile it from linux, provided you've got a proper SDK installed, making the executable helloworld program on AROS-linux-hosted takes this step:
i386-aros-gcc -o helloworld helloworld.c
In both cases, the result will be an executeable called 'helloworld', which should run under AROS.
[edit] Running It
In case you've cross-compiled from linux, move the executable into the AROS-linux-hosted installation tree, e.g. like this (assuming 'AROS/' is the root directory of AROS-linux-hosted, which corresponds to the 'System' partition inside AROS):
> mv helloworld AROS/
Inside AROS, find and run your executable via Wanderer, in our case: double-click 'System' icon on Wanderer desktop, double-click 'helloworld' icon (you might have to hold right mouse button and select 'Window -> View -> All Files' to see it). A window will be opened displaying the program's output.
Or, to run it from AROS' shell, assuming you're still in the same directory where you compiled it, just type it's name:
System:> helloworld
