[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: moving a file with template code to another directory breaks compile

From: Paul Pluzhnikov
Subject: Re: moving a file with template code to another directory breaks compile -- more info
Date: Wed, 29 Mar 2006 21:05:43 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

u19809 <> writes:

> I found in the meantime a way to make it compile but cannot explain why
> the workaround fixes things
> The code I had contains #pragma implementation and #pragma interface in
> the header file.  This matches my findings since these pragma's do
> something with respect to copying header information or not.

They don't do that.

What they do do is prevent creating of template instantiations
('#pragma interface') even when compiler could have created them.
The '#pragma implementation' undoes the effect of '#pragma interface'.

> So Question now remains why does the #pragma things break compile when the
> source file is in a different location as the header

Reading 'info gcc' reveals the answer:

     If you use `#pragma implementation' with no argument, it applies to
     an include file with the same basename(1) as your source file.
     For example, in `', giving just `#pragma implementation'
     by itself is equivalent to `#pragma implementation "allclass.h"'.

So the problem is not that you copied WxAction.cpp into a different
location (that would have worked); the problem is that you also
renamed that file to WxAction_A.cpp

P.S. You probably should remove these pragmas altogether -- they
probably provide minimal disk space savings (none in the final
executable, but some savings in intermediate object files), but
cause headaches and aren't portable either.
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]