[fpc-pascal] problem with command line defines??
Tomas Hajny
XHajT03 at hajny.biz
Wed Nov 28 19:55:20 CET 2012
On Wed, November 28, 2012 19:39, Jonas Maebe wrote:
> On 28 Nov 2012, at 19:22, waldo kitty wrote:
>
>> on OS/2 eCS2 i have fpc 2.6.0 release installed... i've been working
>> with a library and needed to create a define so that some code would be
>> compiled that otherwise is not... since i have to compile from the
>> command line with fpc, i compiled my project like this...
>>
>> fpc -dOS2GCC testhttp
>>
>> and it did compile with the defined code block... later, i wanted to
>> test without that defined code block so i compiled again like this...
>>
>> fpc testhttp
>>
>> but the library wasn't recompiled... i had to manually remove the *.O
>> and *.ppu files to get it recompiled without the defined code block...
>>
>> why?
>
> Changing defines does not cause recompilation of units because e.g. the
> defines required to compile the FPC RTL or packages are completely
> unrelated to any defines that may or may not be required for compiling
> your program. In general, requiring you to specify all defines used for
> every unit you use in a program would result in an unmaintainable
> situation.
>
> Additionally, there are some practical difficulties with adding hints for
> indicating such situations, see
> http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/fppu.pas?annotate=22452#l659
In other words - it is normal, but you can solve it without manually
deleting the created *.o and *.ppu files by using the -B parameter (which
asks fpc to rebuild all units for which it has sources with the new
command line parameters including conditional defines provided on the
command line).
Tomas
More information about the fpc-pascal
mailing list