[aspectc-user] ac++ passed, but c++ -compiler rejects

Martin Kuhlemann martin.kuhlemann at web.de
Sat Dec 10 21:36:30 CET 2005


Hello,

the following aspect causes trouble with my MS Toolkit 2003-Compiler.
The aspectC++-Compiler is passed and the output-code is generated so 
far("void Subject::subscribe()" and "void Subject::subscribe(Observer* 
newClient)" are allready existent in the Components):

#ifndef __connect_ah
#define __connect_ah

#include <iostream>
#include <string>
using namespace std;

//#include "Observer.h"
#include "ConcreteObserver.h"
//#include "ConcreteSubject.h"

//class Observer;
//class ConcreteObserver;

aspect connect{
	pointcut Methods() = execution("% %::subscribe()");

	advice Methods() : after(){
		cout<<"hier soll was eingefügt werden"<<endl;
		string name = "Observer3";
		Observer* newClient = new ConcreteObserver(name);
		string temp = newClient->toString();
		cout<<temp<<endl;
//		tjp->that()->subscribe(newClient);
		tjp->target()->subscribe(newClient);
		cout<<"subscribed "<<newClient->toString()<<endl;
	}
};
#endif

The error of the 2003 Toolkit is:

c:\Dokumente und Einstellungen\martin\Desktop\ObserverAOPAcOk_ClFail\observerAOP
-out\Subject.h(93) : fatal error C1070: mismatched #if/#endif pair in file 
'c:\dokumente und 
einstellungen\martin\desktop\observeraopacok_clfail\observeraop-out
\subject.h'
Generating Code...

(The weird thing is, that, when all but the first "cout" is commented out, 
the ac++ -Compiler in the version 0.9 produces an output, so that the 
resulting main.exe correctly writes "hier soll was eingefügt werden".)

Is there anything wrong with my code? (If needed, I also can send my 
example-observer-pattern.)

Thank you very much and best Regards.
Martin



More information about the aspectc-user mailing list