Recent

Author Topic: Compiling files with includes {$I}  (Read 2720 times)

bauglir

  • Newbie
  • Posts: 6
Compiling files with includes {$I}
« on: April 16, 2015, 02:42:45 pm »
Hi,
this is FPC question, not Lazarus
I have a project using several units, I also use file that contains compilation directives
------------------------
UNIT FILE
unit xxx;
{$I ../cd.inc}

DIRECCTIVE FILE
{$DEFINE ABC}
-----------------------

I have problem when i change the directive file, units do not compile. I have to remove *.o and .*ppu files to force compilation.
fpc -B does not help

How can I force Free Pascal to recompile unit after I change include file? The project is big, there are like 30 units in several directories... deleting compiled files is paintfull


Thanks
Brona

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Compiling files with includes {$I}
« Reply #1 on: April 16, 2015, 02:56:11 pm »
I always do some trivial change in relevant *.pas file, for example add row, delete row and save. FPC afaik uses timestamps, it sees that file was changed and recompiles it, including include file.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

rvk

  • Hero Member
  • *****
  • Posts: 7014
Re: Compiling files with includes {$I}
« Reply #2 on: April 16, 2015, 03:01:08 pm »
I just tested this and fpc (2.7.1) does see changes in an include-file.
When recompiling a program it will also recompile any unit.pas, which includes changed include-files, even without the -B flag.

But if your units are not recompiling, even with the -B flag, you seem to have a different problem than not compiling after a change in an include-file.

(as always it could be handy to mention your fpc and OS-versions)
« Last Edit: April 16, 2015, 03:10:05 pm by rvk »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12842
  • FPC developer.
Re: Compiling files with includes {$I}
« Reply #3 on: April 16, 2015, 03:35:41 pm »
Add -B ?

rvk

  • Hero Member
  • *****
  • Posts: 7014
Re: Compiling files with includes {$I}
« Reply #4 on: April 16, 2015, 03:39:45 pm »
Add -B ?
He already stated fpc -B does not help.

bauglir

  • Newbie
  • Posts: 6
Re: Compiling files with includes {$I}
« Reply #5 on: April 16, 2015, 05:33:26 pm »
I've finally figured it out
it's not enough to include path to inc file from unit, but if you have more complex directory structure and you use project specific config file containing search paths,

CONFIG
-Fu/path/to/units1
-Fu/path/to/units2
-Fu/path/to/units3

compilationa directive:  fpc -B @/path/to/fpc/cfg

one must add
-I/path/to/include/inc

to that config file

 

TinyPortal © 2005-2018