[fpc-pascal] linklib c using mingw, cygwin, both, or ...

Wolfram Kläger wolfram.klaeger at web.de
Mon Oct 6 22:46:47 CEST 2008


> I'm trying to follow the tutorial, How to use C code in FreePascal projects,
> 
> ftp://ftp.freepascal.org/pub/fpc/docs-pdf/CinFreePascal.pdf
> 
> In order to get gcc running on Windows, I tried both options, mingw and cygwin. ...

Solved. Instead of 

{$linklib c}

as described in the tutorial, read

http://community.freepascal.org:10000/bboards/message?message_id=268811&forum_id=24083

and give 

{$linklib c:/mingw/lib/libmsvcrt.a}

a try. Instead of specifying the absolute path, add the following line to the library search path of your fpc.cfg

-Flc:/mingw/lib

or wherever your mingw installation resides. The tutorial mentions, other linking errors might occur or might not, if 

{$link gcc}

is specified, or not. The earlier poster even had to add a

{$Linklib kernel32}

In my case, neither nor is required.

Wolfram

PS Maybe it's a good idea, providing Gilles Marcou's tutorial as a wiki instead of a PDF. At least me, I'd be happy to see continuous updates to such essentials and would not hesitate to do it by myself.



More information about the fpc-pascal mailing list