open a terminal.

[cc lang=”c” escaped=”true” width=”600″]
mkdir -p /projects/c/HelloWorld; # create a directory for the project
cd /projects/c/HelloWorld; # enter that directory
vim HelloWorld.c; # create file
[/cc]

# fill it with this

[cc lang=”c” escaped=”true” width=”600″]
#include

main()
{
printf(“Hello, world!\n”);
return 0;
}
[/cc]

# compile it (cc instead of gcc also works)

[cc lang=”c” escaped=”true” width=”600″]
gcc HelloWorld.c -o HelloWorld.bin;

# you should get a runnable binary file HelloWorld.bin, that you can run like this

./HelloWorld.bin; # run the binary file

# the output should be
Hello, world!
[/cc]

CONGRATULATIONS! YOU JUST CREATED YOUR FIRST LINUX C PROGRAM! 🙂 AND IT’S FUCKING FAST! 😀

Now continue to part two: fist gui app in gnome

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin