[fpc-pascal]help please

Thomas Schatzl tom_at_work at gmx.at
Sun Sep 26 16:00:21 CEST 2004


Janos Krizan schrieb:
> Dear Sirs,
> It is so complicated. I am not subscribed but I need help anyway in
 > order to get started.

[A copy of this answer is cc'ed to the original From: address]

> I have dosw321010full.zip version of free Pascal and I can not make 
 > it work. I suspect that it has to do something with properly
 > configuring it.

[... file list snipped ...]

> My autoexec.bat for windows 98 has following statements

The order of the path statements is significant. With the first two 
lines you add the required paths for fpc, but with the third you reset 
it to C:\WINDOWS; etc. again.

Just move the first two lines after the third and it should solve some 
of below problems.

> Test program hello work but when I tried something from the manuals such as
> Begin
> Writeln ( ' Cur rent Di r e c t o r y i s : ' , GetCur rentDi r ) ;
> End.
> it cracked reporting 


> and 
>  pisi.pas(2,49) Error: Identifier not found GETCUR
>  pisi.pas(2,56) Fatal: Syntax error, ) expected but identifier RENTDI found
> I suspect that it has to do something with properly configuring the program
 > so if you could be so kind to help me how.

The problem is that the method GetCurrentDir() can't be found by the 
compiler - it seems that you didn't copy the complete program from the docs.

This method is included in a library ("unit" in Pascal terms) called 
"sysutils" - you have to tell the compiler to look in this library for 
unknown methods too. E.g. add a "uses sysutils;" directive at the top of 
your program.

This program in particular should look like this to compile:


	Writeln('Current Directory is: ' , GetCurrentDir);

> -------------------------------
> Also when I tried that hello program from dos it did not worked 
 > giving me following report
> Load error: no DPMI - Get csdpmi*b.zip
> It does work fine in MS - DOS prompt of windows 98 I believed since 
 > it was compiled from Target: DOS (GO32V2) that it will work under DOS.

FPC creates so-called protected mode DOS programs (GO32V2). These 
programs need a DPMI extender (loader) which is included in a file 
called csdpmi*b.zip, in particular the file cwsdpmi.exe from the 
unzipped FPC distribution.

It is used to switch to and from protected mode of the CPU under plain 
DOS; Windows by default provides such an extender for its DOS boxes so 
you don't need it there.

That also means that you need to include cwsdpmi.exe (or csdpmi*b.zip, 
see google) to every GO32V2 program you give away.

> I hope You can help me. Searching through help files and manuals in 
 > PDFformat I found many routines (sub programs, functions etc)
 > but I obviously do not know how to make program see them and
 > include them into the compilation process of main program.

Similar to the GetCurrentDir() case you always have to tell the compiler 
where (in which "unit") it should look for these methods. Add the name 
of the library which contains the method you want to use to the uses 
clause at the top of your program.

> Where are (what is the required path for) Cross tools directory, 
 > EXE & PPU directories , Object directories ,Library directories,
 > Include directories and Unit directories?

Cross tools directory: in this field you enter the path to the tools 
used for cross platform development, that means developing programs for 
another (usually incompatible to the one you develop on) platform. For 
example developing Linux programs on the Windows platform. This is 
usually not needed.

EXE & PPU directory: I think this is the directory where your compiled 
executables (EXE) and units (PPU) are written to instead of the current 
directory. Helps keeping the source directories free from binaries.

Object directory: This path is used when looking for files that need to
be linked in. Used e.g. in the case you want to use a module written in 
C and use it in FPC. Not needed in case you do Pascal-only development.

Library directory: These are additional directories you can pass to the 
linker where he searches for libraries then. Not needed in case you do 
Pascal-only development.

Include directories: The compiler searches in this directories if you 
include a file via the $I (or $INCLUDE) directive in addition to the 
current directory.

Unit directories: Directories (in addition to the current directory) 
where the compiler searches for compiled units you added to your uses 

> I am not experienced programmer so that I could know just by looking
 >  atthe files which belongs where.

Hope this helps,

More information about the fpc-pascal mailing list