[aspectc-user] error: 'advice' keyword used outside an aspect.

Olaf Spinczyk os at aspectc.org
Mon Sep 5 10:29:25 CEST 2016


The semantics of AspectC++ only allows for advice within the body of an
aspect. Therefore, the parser checks the current scope when an advice
definition is seen and prints an error message if advice is found
"outside an aspect".

Your code looks correct to me. I am only confused, because stim2.ah:10
is not the line that contains the advice keyword in your listing (it is
line 8). Have you removed lines before you posted them here? It might be
a good idea to search for "advice" in your whole project (e.g. with grep
-r advice <MyProject>). It sometimes happens that 'advice' is used a
name for a local variable or function. If that is used with a macro, it
might be hard to spot. Also check that opening and closing brackets are
correct. For instance, you could comment-out the advice definition a
check whether the code can be compiled after doing that.

Best regards,


Am 03.09.2016 um 16:11 schrieb Jeremy:
> Hi,
> I get the error information: "*stim2.ah:10: error: 'advice' keyword
> used outside an aspect." *when I try to use aspectC++.
> I have a class named *stim *with a method named*StimGen() *in file
> stim.h. And I write an aspect file *stim2.ah* as follows:
> #ifndef STIM2_AH__
> #define STIM2_AH__
> #include "stim.h"
> aspect stimModify{
> advice execution("% stim::StimGen()") && that(instance) : before(stim
> &instance){
> instance.A.write(false);
> instance.B.write(true);
> wait();
> instance.A.write(true);
> instance.B.write(false);
> wait();
> sc_stop();
> }
> };
> #endif
> Does anyone know what's wrong about this error?  Could you please say
> something about this kind of error? Any suggestions would be appreciated.
> Thanks a lot in advance.
> ------------------
> Best regards,
> Haifeng
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20160905/aa6fce33/attachment.html>

More information about the aspectc-user mailing list