On Sun, May 31, 2020 at 6:34 AM <ron(a)ronnatalie.com> wrote:
Anyway, I've tried compiling Hello World on
LSX, and I get "1: External
definition syntax" error. Some help would be nice, but more generally, is
anyone on this list more than vaguely familiar with LSX, or 6th Edition
itself?
void main () {
printf("Hello World!");
}
It seems that the 7th Edition was the beginning of the standard library
in
C, and that this is missing in LSX. I'm not
sure if printf is an
intrinsic
function in (6th Edition) C, or if it's from
a library.
First off, VOID MAIN is not legal in any standard version of C. Even when
the language allows implementation defined extensions to the main
signature, it must still return int.
If you have a later version of language supported, you have to define
printf rather than allowing it default define as an int returning
function.
Add #include <stdio.h>
Or, alternatively, LSX is really old. The compiler there likely doesn't
support 'void'.
From the lsx part of tuhs:
# cp /dev/tty8 addr.c
main() {
int a;
printf("main address: %u (0%o)\n", main, main);
printf("stack address: %u (0%o)\n", &a, &a);
printf("heap address: %u (0%o)\n", sbrk(0), sbrk(0));
}
^D
# cc addr.c
# a.out
main address: 16410 (040032)
stack address: 40934 (0117746)
heap address: 17920 (043000)
None of the disks appear to have a /usr/include. The only .h files look
like they were from the kernel.
Warner