Recent

Author Topic: [Solved] Compiling SDL program from the command line (Linux)  (Read 3113 times)

mrguzgog

  • Jr. Member
  • **
  • Posts: 71
I've been following along the tutorials at freepascal meets sdl[1]

Everything works fine compiling/running from Lazarus but I'd like to understand the basics of compilation from the command line. The information on the wiki I've found about compiling[2] seems to relate to the fp ide. Can someone please tell me how I would build main.pas and unit1.pas with the sdl libraries into an executable 'myprogram' or point me to a tutorial on the matter (I don't need to know all the compiler options at this stage!)?

Paul.

[1]http://www.freepascal-meets-sdl.net/chapter-3-first-steps/
[2]http://www.freepascal.org/docs-html/user/userse29.html#usersu71.html
« Last Edit: July 22, 2016, 04:47:14 pm by mrguzgog »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8726
  • FPC developer.
Re: Compiling SDL program from the command line (Linux)
« Reply #1 on: July 22, 2016, 10:35:04 am »
Just pass the path to SDL2 with -Fu on every commandline or add

-Fu/usr/local/lib/where/I/installed/SDL2

to your fpc.cfg or .fpc.cfg depending on how FPC was installed with or without admin rights, slight distribution differences also apply.

Make sure to pay attention to the texts how SDL is installed.

molly

  • Hero Member
  • *****
  • Posts: 2345
Re: Compiling SDL program from the command line (Linux)
« Reply #2 on: July 22, 2016, 11:31:35 am »
Which seems to be explained here in the documentation.

mrguzgog

  • Jr. Member
  • **
  • Posts: 71
Re: Compiling SDL program from the command line (Linux)
« Reply #3 on: July 22, 2016, 04:46:56 pm »
Thank you both.

Code: [Select]
fpc sdl-test.pas -Fu"/usr/local/share/sdl2"

Does the trick, despite me skim-reading and misunderstanding the functioning of the wildcard operator with regard to directories.

 

TinyPortal © 2005-2018