Lazarus

Programming => General => Topic started by: rnfpc on July 12, 2019, 03:07:04 am

Title: How to use fileutils from fpc
Post by: rnfpc on July 12, 2019, 03:07:04 am
I am using Free Pascal Compiler version 3.0.0+dfsg-11+deb9u1 [2017/06/10] for x86_64 on Debian Stable Linux with Lazarus.

I find that I am not able to use packages fileutil with fpc for command line applications as in this question: https://forum.lazarus.freepascal.org/index.php/topic,44207.0.html

How can I use fileutil with fpc? I tried using following option with fpc command:
Code: Pascal  [Select][+][-]
  1. -Fu/usr/lib/lazarus/1.6.2/components/lazutils
But then fpc starts compiling those files and it cannot since that needs root privileges. Can I copy files from that folder to some folder in my home directory and use them? Will that work? Thanks for your help.



Title: Re: How to use fileutils from fpc
Post by: jamie on July 12, 2019, 03:59:22 am
Most coders have full PC at their hands..
Title: Re: How to use fileutils from fpc
Post by: lucamar on July 12, 2019, 05:37:58 am
You have to use the full path to where the compiled object files are. In this system*, for example, this works for a small test program using "FindAllFiles":
Code: [Select]
fpc -Fu/usr/share/lazarus/2.0.2/components/lazutils/lib/i386-linux/ test.pas
(*) Lazarus 2.0.2/FPC 3.0.4 on Ubuntu 12.04
Title: Re: How to use fileutils from fpc
Post by: Bart on July 12, 2019, 10:51:21 am
Since you do seem to have Lazarus: open the program in Lazarus (the IDE will suggest to make a projet (.lpi) for it: accept that). Then in Project Inspector simply add a dependency for LazUtils package.

Bart
Title: Re: How to use fileutils from fpc
Post by: marcov on July 12, 2019, 10:59:06 am
Since you do seem to have Lazarus: open the program in Lazarus (the IDE will suggest to make a projet (.lpi) for it: accept that). Then in Project Inspector simply add a dependency for LazUtils package.

But .lpi's can't be used with the commandline compiler. Maybe you can use lazbuild though.
Title: Re: How to use fileutils from fpc
Post by: Bart on July 12, 2019, 11:14:11 am
But .lpi's can't be used with the commandline compiler. Maybe you can use lazbuild though.

Personally I would use Lazarus as IDE and have the advantage of all codetools and build the project in Lazarus IDE.
Another alternative:
Menu->Project-?Project Options->Show Options: this will show you all used paths, you can copy that when you invoke the compiler by hand.

Bart
TinyPortal © 2005-2018