Olivier PECHEUX wrote:
I have loaded the gpc (5/99). I use rhide and windoze. And I have troubles: When I compile, Rhide call "gpc -o etape.exe --automake="-g" -g etape.pas -lm -lgpc"
First, --automake="-g" aren't in the documentation and I have the message "ignoring AutoMake option -g";
This was changed in the last release of GPC. Instead of `--automake="-g" -g', you should now simply say `--automake -g' (i.e., no need to repeat the options for automake).
Is it possible to change the call?
If you have the RHIDE source and can compile it, it should be easy to change the GPC invocation. Otherwise you'd have to ask Robert, the RHIDE author, to do it.
Second: with the -lgpc the program dosn't reconize the gpc librairie (GPC_randomize is't reconize at all). But if I put "uses gpc" it does. Why?
Third: What does mean -lm? Is there an m librarie?
There is a difference between libraries and units/modules. Libraries are originally a C concept -- they consist only of object code without any interface declarations (these are in header files in C), while Pascal units/modules consist of code and declarations.
GNU Pascal can use libraries with `-l' switches, but this only provides the object code, not the interface declarations.
E.g., the GPC Run Time System is in libgpc.a which is linked with the `-lgpc' switch. However, to make available the declarations, you have to use the unit GPC (which is in gpc.pas), as you noticed. (BTW, don't use GPC_Randomize in your programs. It's an internal routine. The compiler knows `Randomize' which will ultimately call GPC_Randomize, but is more portable. For `Randomize', you don't even have to use GPC, but for other declarations, you do.)
Similarly, there's a math libarary (libm.a, -lm) which contains routines like sin and cos. For them, you don't need to use any unit, because the compiler knows about them.
Actually, GPC knows already that it needs -lgpc and -lm, so one doesn't have to specify those two libraries explicitly (and this has been so for a few years at least). I don't know why RHIDE adds them, but that's unnecessary.
To put it shortly, don't worry about libraries (i.e., `-lfoo' options). Just use the units you want, and you should be fine.
This also holds for units like CRT which need additional libraries (curses), because they take care of the libraries automatically.
When I compile a librairie, I have an "undefinied reference to main" message. For now I ignore it because it's work. What is your position? What I have to do?
I suppose you mean a unit. Indeed, it doesn't cause any problems except this error message, but you can give the `-c' option, and the message will disappear. (Perhaps in the future, you won't need `-c', but currently, you do.)
Frank
-- Frank Heckenbach, frank@fjf.gnu.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html