Hi!
I've got a little problem I've been dealing with for several days :((
Code is written in Qt.
I'll try to explain it:
I created an abstract class "VcaNode" with 4 virtual methods and 3 other members...it is in special header:
[code=cpp]//ABSTRACT CLASS MEMBER:
#ifndef _VCA_NODE
#define _VCA_NODE
#include <vca_net.h>
#include <canmsg.h>
#include <iostream>
using namespace std;
#include <QObject>
class VcaNet;
class VcaNode : public QObject
{
Q_OBJECT
public:
VcaNet *cannet;
VcaNode(VcaNet *parent){
this->cannet = parent;
};
virtual ~VcaNode() {cout <<"Node Has Been destroyed/disconnected"<< endl;};
void emitSentSignal( int event_code, const canmsg_t *canmsg){
emit sentMsg(event_c ode, canmsg);
}
virtual void connectNode() = 0;
virtual int vcaSendMsgSeq(c anmsg_t *messages, int count) = 0;
virtual int vcaRecMsgSeq(ca nmsg_t *messages, int count) = 0;
signals:
void sentMsg(int event_code, const canmsg_t *canmsg);
public slots:
virtual void nodeReady() = 0;
};
#endif[/code]
Then I want to inherit it and override virtual methods ...So I created another class "VcaFdNode" that looks like this:
[code=cpp]//INHERITED CLASS
#ifndef _CAN_VCA_H
#define _CAN_VCA_H
#include <vca_net.h>
#include <vca_node.h>
#include <vca_net.h>
#include <QObject>
#include <QSocketNotifie r>
#include <stdarg.h>
#ifndef __RTL__
#include <sys/time.h>
#else /*__RTL__*/
#include <time.h>
#endif /*__RTL__*/
#include <can.h>
class VcaNet;
//class VcaNode;
class VcaFdNode : public VcaNode
{
private:
int vcah;
int vcaWait(int wait_msec, int what);
long vcaH2log();
public:
bool vca_ok;
QSocketNotifier *sn;
VcaFdNode(VcaNe t *_cannet, const char *dev_name/*, const char *options, int flags*/);
~VcaFdNode();
void connectNode();//OK
int vcaSendMsgSeq(c anmsg_t *messages, int count);//OK
int vcaRecMsgSeq(ca nmsg_t *messages, int count);//OK
int getVcaHandle();
void setVcaHandle(in t handle);
int vcaH2fd();
public slots:
void nodeReady();//OK
};
#endif[/code]
But when I try to compile source code using these header I got this error:
./vca_fdnode.h:23 : error: expected class-name before '{' token
vca_fdnode.cpp: In constructor 'VcaFdNode::Vca FdNode(VcaNet*, const char*)':
vca_fdnode.cpp: 63: error: type 'VcaNode' is not a direct base of 'VcaFdNode'
and so on :(
ANYONE help ? :)
THANKS A LOT IN ADVANCE...
I've got a little problem I've been dealing with for several days :((
Code is written in Qt.
I'll try to explain it:
I created an abstract class "VcaNode" with 4 virtual methods and 3 other members...it is in special header:
[code=cpp]//ABSTRACT CLASS MEMBER:
#ifndef _VCA_NODE
#define _VCA_NODE
#include <vca_net.h>
#include <canmsg.h>
#include <iostream>
using namespace std;
#include <QObject>
class VcaNet;
class VcaNode : public QObject
{
Q_OBJECT
public:
VcaNet *cannet;
VcaNode(VcaNet *parent){
this->cannet = parent;
};
virtual ~VcaNode() {cout <<"Node Has Been destroyed/disconnected"<< endl;};
void emitSentSignal( int event_code, const canmsg_t *canmsg){
emit sentMsg(event_c ode, canmsg);
}
virtual void connectNode() = 0;
virtual int vcaSendMsgSeq(c anmsg_t *messages, int count) = 0;
virtual int vcaRecMsgSeq(ca nmsg_t *messages, int count) = 0;
signals:
void sentMsg(int event_code, const canmsg_t *canmsg);
public slots:
virtual void nodeReady() = 0;
};
#endif[/code]
Then I want to inherit it and override virtual methods ...So I created another class "VcaFdNode" that looks like this:
[code=cpp]//INHERITED CLASS
#ifndef _CAN_VCA_H
#define _CAN_VCA_H
#include <vca_net.h>
#include <vca_node.h>
#include <vca_net.h>
#include <QObject>
#include <QSocketNotifie r>
#include <stdarg.h>
#ifndef __RTL__
#include <sys/time.h>
#else /*__RTL__*/
#include <time.h>
#endif /*__RTL__*/
#include <can.h>
class VcaNet;
//class VcaNode;
class VcaFdNode : public VcaNode
{
private:
int vcah;
int vcaWait(int wait_msec, int what);
long vcaH2log();
public:
bool vca_ok;
QSocketNotifier *sn;
VcaFdNode(VcaNe t *_cannet, const char *dev_name/*, const char *options, int flags*/);
~VcaFdNode();
void connectNode();//OK
int vcaSendMsgSeq(c anmsg_t *messages, int count);//OK
int vcaRecMsgSeq(ca nmsg_t *messages, int count);//OK
int getVcaHandle();
void setVcaHandle(in t handle);
int vcaH2fd();
public slots:
void nodeReady();//OK
};
#endif[/code]
But when I try to compile source code using these header I got this error:
./vca_fdnode.h:23 : error: expected class-name before '{' token
vca_fdnode.cpp: In constructor 'VcaFdNode::Vca FdNode(VcaNet*, const char*)':
vca_fdnode.cpp: 63: error: type 'VcaNode' is not a direct base of 'VcaFdNode'
and so on :(
ANYONE help ? :)
THANKS A LOT IN ADVANCE...
Comment