[aspectc-user] Compile after weaving
Olaf.Spinczyk at informatik.uni-erlangen.de
Fri Jul 14 18:19:22 CEST 2006
Yan Mao wrote:
> maybe this is a silly question, but i really cant find out, how to compile the VC projects after ac weaving.
> suppose i have a simple vc project "Trace". It contains 2 directories "inc" and "src". In "src", i have "main.cpp" and a class "Father.cpp". In "inc", i have "Father.h" and aspect "Trace.ah".
> I weaved the project successfully with the command:
> ac++ -p Trace -d Trace_Out –I Trace --no_line –e cpp --vc -v9
> The directory "Trace_Out" I got, contained only .cpp .h and .ah files, all VC project related files are not there any more.
> So far so good.
> The problem now is, how can I compile the weaved code.
> I tried to make a new project with VC and add these files to the project and compile them, but i got the following Errors:
> ...\trace_out\src\main.cpp(58) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'inc/Trace.ah': No such file or directory
> ...\trace_out\src\father.cpp(70) : error C2252: 'JPID' : Nur Funktionen koennen rein virtuell deklariert werden
> ...\trace_out\src\father.cpp(71) : error C2258: Ungueltige Syntax fuer rein virtuelle Methode; '= 0' erforderlich
> ...\trace_out\src\father.cpp(71) : error C2252: 'JPTYPE' : Nur Funktionen koennen rein virtuell deklariert werden
> ...\trace_out\src\father.cpp(108) : error C2258: Ungueltige Syntax fuer rein virtuelle Methode; '= 0' erforderlich
> Can anybody help me?
> The line number are also irrational, they are offset from the real places. why?
> For the first error, it should be '../inc/Trace.ah', but why it changed to 'inc/Trace.ah'?
> How to get rid of the errors related JPID, JPTYPE?
> and How do you weave and compile VC projects in a eay way?
> thanks a lot
> Yan Mao
If you are asking for the easiest way, then I can only recommend to
download the AspectC++ Add-In for Visual Studio .NET from
www.pure-systems.com. It is commercial, but a trial version is available.
The problem is to get the right parser configuration file for ac++ (e.g.
puma.config). This is not trivial. In the case of g++, the ag++ command
generates the parser configuration file for you. In the case of VC++,
the AspectC++ Add-In for Visual Studion also comes with a valid parser
configuration file. Writing it manually means that you have to find out
and enter all built-in include paths and predefined macros of your
compiler. Therefore, have a look at the Add-In.
If you want to dig deeper without the Add-In, I would recommend to use
the single translation unit mode, where includes are automatically
expanded by the weaver. The generated #line directives make sure that
line numbers in error messages are correct (mostly).
=> ac++ -p Trace -I Trace -c Trace/main.cpp -o Trace/Debug/main.cpp
(also -I Trace/inc?)
Finally, compile all files in Trace/Debug with VC++.
I hope this helps,
More information about the aspectc-user