gregor001 wrote 1 year ago reply Hi ya all:)
short: How to write simplest "HELLO" program in Slax?
i read that it has already included gcc compiler.
can please someone write whgole steps, please (with prorgam)?
i guess it goes something like that:
1)write a program in word processor:
cout forum wrote 1 year ago reply Open up a console window.
type vi hello.c and use the vi editor to create the file.
Then use gcc to compile the file, and run the resulting a.out file.
Here is the file, and the steps to compile and run:
root@slax:~# cat hello.c
/* Hello World program */
#include
main()
{
printf("Hello World\n");
}
root@slax:~# gcc hello.c
root@slax:~# ls
Desktop/ a.out* hello.c
root@slax:~# ./a.out
Hello World
root@slax:~#
forum wrote 1 year ago reply Oops, the web interface messed up the #include line. Should be:
#include\ forum wrote 1 year ago reply Dammit. The line should be #include stdio.h, with stdio.h enclosed in angle brackets. vonbiber wrote 1 year ago reply Write the program (from a console):
cat > main.c <<EOF
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
EOF
build:
gcc main.c -o hello
run:
./hello
agreimann wrote 1 year ago reply Yes. I was about to say what vonbiber was going to say. :) That'd be what I'd recommend doing. You could use echo as well here, instead of cat:
root@slax# echo "\
#include <stdio.h>
int main()
{
*/ Display the greeting here /*
printf("hello world\n");
*/ Quit /*
return 0;
}" > ccode.c
root@slax# gcc ccode.c -o cprogram
root@slax# ./cprogram
I might add that bash is an undervalued but fully Turing-compliant language that can also make programs (especially when combined with Perl, for instance). In this case, however, this is just a little script, but it can get the simple job done as well:
root@slax# echo "\
#!/bin/bash
# Display the greeting here
echo "Hello, world."
# Quit
exit 0" > bashapp
root@slax# chmod +x bashapp && ./bashapp
Anyway, good luck... :) openxcellaus wrote 1 year ago reply Nice example are given by you and I have just tried these examples. Really good and let's me try other programming.
http://www.openxcell.com.au/website-development-australia nickkkkk wrote 1 year ago reply Use python, it easy:
print "HELLO" python-commenter wrote 1 year ago reply I believe for the latest python it is:
print ("HELLO") admiral.adney wrote 319 days ago reply yup you are write its
print ("HELLO") agreimann wrote 319 days ago reply Guys, why cap HELLO here? In Python 2/3.x, it can be just like this: print("Hello") admiral.adney@gmail.com wrote 207 days ago reply its a test reply.