[aspectc-user] multiple definition errors for "global" variables

Hans VB hans.vanbroeckhoven at telenet.be
Thu Feb 3 13:34:07 CET 2005


Hello,

Olaf Spinczyk wrote:

> the reason is that aspect headers are automatically included in all 
> translation units, which are affected by the aspect. You would have 
> the same results if you defined the ofstream in a normal header file, 
> which you include in more than one cpp file.
>
> The solution is to create a "LoggingAspect.cpp" file, which defines 
> your ofstream logfile("test.log") and includes the aspect header 
> explicitely. In the aspect header you only have an extern 
> declaration:extern ofstream logfile;
>
> Olaf

It doesn't give any compiler or weaving errors, but unfortunately, AC++ 
doesn't seem to go in this LoggingAspect.cpp file. Everything in it is 
just ignored. It was also the first time I heard of using the .ah-files 
really just as a header. I'm using the ACDT, could that have something 
to do with it?

Greets,
Hans




More information about the aspectc-user mailing list