Raspberry / Linux: minimum sample console 'Hello World'

Raspberry PI specific forum
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Raspberry / Linux: minimum sample console 'Hello World'

Post by Marc56us »

How-to compile a minimum console program on Raspberry or Linux

(Put package in your home dir (or wherever you want)
(uncompress it)
(use <tab> to complete the package name)
(whatever '' in name)
tar xvzf PureBasic...

Code: Select all

pi@raspberry:~ $ tar xvzf PureBasic_Linux_beta_ <tab>
(set PB home dir (only need for command line version))
export PUREBASIC_HOME=~/...

Code: Select all

pi@raspberry:~ $ export PUREBASIC_HOME=~/purebasic
(make a sample pb code)
(use vi, nano or anything else)
(here, mini: 'cat' command)

Code: Select all

pi@raspberry:~/purebasic/compilers $ cat > hello.pb
PrintN("Hello World!")
^C
(verify)

Code: Select all

pi@raspberry:~/purebasic/compilers $ cat hello.pb
PrintN("Hello World!")
(compile)
./pbcompiler hello.pb -e hello

Code: Select all

pi@raspberry:~/purebasic/compilers $ ./pbcompiler hello.pb -e hello
PureBasic 6.00 Beta 1 - C Backend (Linux - arm32)
Loading external modules...
Starting compilation...
Starting compilation...
3 lines processed.
Creating the executable.

- Feel the ..PuRe.. Power -
(yes, that's it)

(test)
./hello

Code: Select all

pi@raspberry:~/purebasic/compilers $ ./hello
Hello World!
Congratulation, you have done your first unix program :D