Larry Poorman wrote:
I am using S.u.S.E 6.2 but wanted to try the Regular Expresions in Pascal. So I de-installed the S.u.S.E version and downloaded a binary and installed it. However when I enter: gpc -v I get the following message:
bash-2.03# gpc -v GPC wrapper script, created by install-gpc-binary Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60/sp gpc version 19990118, based on egcs-2.91.60 19981201 (egcs-1.1.1 release) ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti 6-pc-linux-gnulibc1/egcs-2.91.60/crtbegin.o -L /usr/local/lib/gcc-lib/i586-pc-li usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60 -L/usr/local/lib/gcc-l s-2.91.60 -L/usr/local/lib -lgpc -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i586 60/crtend.o /usr/lib/crtn.o /usr/lib/crt1.o(.text+0x36): undefined reference to `main'
Any suggestion as to what I could do to eliminate the "undefinded reference to main" message?
I have been using Borland Pascal for the last ten years (mostly maintenance work as opposed to development) and therefore am curious as to how GPC functions as compared to Borland, i.e. what are the TPU, TPP, TPW equivalents in GPC and how are they linked in? If this is explained in some part to the documentation just point me in that direction.
Several things:
- You use the install-gpc-binary script which is needed when installing a binary in a directory other than which it was compiled. This is not usually necessary under Linux (since we offer several binaries suited for different distributions and it's easy to compile GPC yourself under Linux), but it's not necessarily wrong...
- The "undefined reference to `main'" problem when calling gpc with `-v' and some more parameters (which are implicitly passed by the install-gpc-binary script here) will be fixed in the next release, but it's not very serious, anyway. As soon as you actually compile a program (i.e., give a file name), it does not occur.
- The equivalent of BP's tp[upw] files in GPC are object files (.o) plus interface files (.gpi) (and in the case of EP modules rather than BP units, also .gpm files). The object files are completely compatible with GCC and (at least under Unix systems) just about any other compiler and assembler, so they are linked with the default linker (ld) which is called automatically by GPC when compiling a program. (OTOH, if you just want to compile a unit alone, and not link it, you have to give the `-c' switch.) The .gpi and .gpm files are used by GPC only and are read when compiling a program, unit or module that uses another unit or module.
- When compiling a program that uses units, give the `--automake' switch to make GPC compile the units automatically.
- For regular expressions you need the rx library. If it isn't installed on your system, you can get it from ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/libs/
Frank