My guess is the "uses crt" is not needed for linux. If you still need your code to run under turbo pascal then put an IFDEF around it. You also shouldn't need the --automake when compiling...


On Sat, Jan 24, 2009 at 11:05 AM, Alexey Kotlyarov <koterpillar@gmail.com> wrote:
Being compiled version of GPC installed on Ubuntu, the following very
simple program fails to produce any output:

program testcrt;
uses crt;
begin
       writeln('OK');
       writeln(sqrt(-1)); { error }
end.

$ gpc --automake testcrt.pas -o testcrt
$ ./testcrt
./testcrt: argument to `SqRt' is < 0 (error #708 at 40b6c6)

Notice the absence of OK. Similarly, removing error line makes program
produce no output. Removing 'uses crt;' restores normal behavior.

Version info and such:
$ gpc --version
gpc 20070904, based on gcc-4.1.3 20080420 (prerelease) (Ubuntu
2.1-4.1.2-22ubuntu1)
Copyright (C) 2006 Free Software Foundation, Inc.
$ uname -a
Linux flower2 2.6.27-11-generic #1 SMP Fri Jan 23 13:58:13 UTC 2009
x86_64 GNU/Linux

Any ideas of how to fix this?