[aspectc-user] Compile problem with generated code

Olaf Spinczyk os at aspectc.org
Fri Sep 19 11:00:35 CEST 2008


Hello Oliver,

I saved your code, removed all #include directives that cannot be 
resolved on my system (and depending code), and compiled it with ag++ 
1.0pre3. It worked without the error messages that appear on your system.

Just a few remarks:

* Always use an include guard in your aspect header files. This is a 
more general remark. Your minimal example can be compiled even without 
an include guard in the aspect header.

* There is a #endif in RCNetwork.H without corresponding #ifdef/ifndef.

* Shouldn't RCNetwork.H be called RCNetworkInterface.H? I renamed the 
file and also adapted the #include in RCNetworkInterface.C.

I don't know if these problems only showed up, because you used 
copy&paste to get the code into the email or if they appear in your code 
as well. If they do, this might cause trouble ...

Best regards,

Olaf


Oliver Zweigle wrote:
> Hello,
>
> I'm new to AspectC++ so if my problem is more or less simple I'm sorry.
> Nevertheless I couldn't find a solution.
> I want to compile a library with only one class and only one aspect for
> testing. I tried to compile with the following command: 
>
> ag++ RCNetworkInterface.C -c -g -Wall -p. -a RCAspects.ah
> -march=prescott -O2 -pipe -fomit-frame-pointer -DQT_THREAD_SUPPORT
> -D_REENTRANT -D_GNU_SOURCE -DLINUX -D_RobotControl_=\"RobotControl1-1\"
> -I/home/zweiglor/robBK/PTHR/include -I/home/zweiglor/robBK/PFF/include
> -I/home/zweiglor/robBK/RobotCom/include
> -I/home/zweiglor/robBK/SUTIL/include
> -I/home/zweiglor/robBK/DConf/include
> -I/home/zweiglor/robBK/RobotControl/include
> -I/home/zweiglor/robBK/SocketComm/include 
> -I/usr/share/qt3/include 
> -o LINUX/RCNetworkInterface.o
>
> The complilation process always throws errors like:
> LINUX/RCNetworkInterface.acc:173: error: 'class RCNetworkInterface' has
> no member named '__exec_old_init'
>
> I've also tried to simply weave the code with ac++ and compile it after
> wards. But the result was the same. It seems to me that the weaver is
> running into problems because of missing declarations.
>
> It would be very nice if you could help me out.
>
> Kind regards,
> Oliver
>
> The aspect file looks like this:
>
> RCAspect.ah:
>
> #include <cstdio>
>
> aspect Tracing {
>   advice execution ("% ...::%(...)") : before () {
>     std::printf("in %s\n", JoinPoint::signature());
>   }
> };
>
> the .h file looks like this:
> RCNetwork.H
>
> #include <sys/time.h>
>
> #include "RobotCom/RMObserver.H"
> #include "PTHR/locks.H"
> #include <map>
> #include <string>
>
>
> class RCNetworkInterface : public RMObserver {
>
>   public: 
>
>   static RCNetworkInterface* getInstance();
>   
>   /// Constructor
>   RCNetworkInterface();
>
>   RCNetworkInterface(string host, string port, string id, string bmode,
> bool isRobot);
>
>   /// Destructor
>   virtual ~RCNetworkInterface(void);
>
>   
>   bool readConfig();
>   
>   PTHR_rwlock rcMutex_;
>     
>   //protected:
>   
>   
>   private:
>   
>   void Update(RobotMessage* rMessage, RobotMessage::SubMessageTypes
> smType);
>   bool init();
>
>   static RCNetworkInterface *instance;
>   static PTHR_mutex instanceMutex;
>
>   bool mdpRunning_;
> };
>
> #endif
>
>
> and the .C file like this:
> RCNetworkInterace.C:
>
>
> #include "RobotControl/RCNetworkInterface.H"
>
> #include <stdlib.h>
> #include <string>
>
>
> #include "RobotCom/RCMessage.H"
> #include "RobotCom/ReceivedMessages.H"
> #include "RobotCom/ServerRequestMessage.H"
> #include "RobotCom/ClientThread.H"
> #include "RobotCom/SendMessages.H"
>
> #include <assert.h>
>
> using namespace std;
>
> PTHR_mutex RCNetworkInterface::instanceMutex = PTHR_mutex();
>
> RCNetworkInterface *RCNetworkInterface::instance = NULL;
>
> RCNetworkInterface* RCNetworkInterface::getInstance() {
>   PTHR_SimpleLock llock =
> PTHR_SimpleLock(RCNetworkInterface::instanceMutex);
>
>   if (instance == NULL) {
>     instance = new RCNetworkInterface();
>   }
>   return instance;
>
> }
>
>
> //
> ----------------------------------------------------------------------
> /** Constructor */
> RCNetworkInterface::RCNetworkInterface() {
>   init();
> }
>
> RCNetworkInterface::RCNetworkInterface(string host, string port, string
> id, string bmode, bool isRobot) {
>   init();
> }
>
> bool RCNetworkInterface::init() {
>   ReceivedMessages::getInstance()->Attach(this, "Robot_Control");  
>   return true;
> }
>
>
> //
> ----------------------------------------------------------------------
> /** Destructor */
> RCNetworkInterface::~RCNetworkInterface(void) {
>   ReceivedMessages::getInstance()->Detach(this, "Robot_Control"); 
>   
> }
>
> void RCNetworkInterface::Update(RobotMessage* rMessage,
> RobotMessage::SubMessageTypes smType) {
>  
> }
>
>
>
>   




More information about the aspectc-user mailing list