When I do that I get
../my_sockets/my_sockets.h:46: Warning: Cannot use Q_OBJECT in nested class.
../my_sockets/my_sockets.h:78: Error: syntax error
make: *** [.moc/moc_my_sockets.cpp] Error 1
Below is my complete header file, just in case you see something else that may cause this. I had a few more #ifndef statements, but commented them out to make sure that the one I'm looking at is really the offending one.
#ifndef MYSOCKETS_H
#define MYSOCKETS_H
#include "rbTree.h"
#include "Fields.h"
// just for file testing
#include <iostream>
#include <fstream>
//#include <csignal>
//#ifndef NOQT
#include <qframe.h>
#include <qobject.h>
//#endif
using namespace std;
// global methods
void* server_thread_stub(void*);
void* server_rcv_thread_stub(void*);
void* client_rcv_thread_stub(void*);
typedef struct position{
int lateral;
int distance;
int vertical;
};
typedef struct client_info{
int fd;
bool master;
char ip[20];
char name[100];
int video;
};
#ifndef NOQT
Q_OBJECT
#else
class Server{
#endif
public:
Server(int);
virtual ~Server();
int server_thread(void);
int getImage();
// client functions
int connectClient(int);
int send();
int sendImage(char *);
friend int receive_message(int);
friend void* server_rcv_thread_stub(void*);
friend void* client_rcv_thread_stub(void*);
rbTree<int> client_tree;
//Server( QObject *parent=0, const char *name=0 );
//#ifndef NOQT
signals:
void updateClientList();
//#endif
private:
static unsigned long int tid;
int port;
int newsockfd;
int newClientsockfd;
};
#endif //MYSOCKETS_H
#ifndef MYSOCKETS_H
#define MYSOCKETS_H
#include "rbTree.h"
#include "Fields.h"
// just for file testing
#include <iostream>
#include <fstream>
//#include <csignal>
//#ifndef NOQT
#include <qframe.h>
#include <qobject.h>
//#endif
using namespace std;
// global methods
void* server_thread_stub(void*);
void* server_rcv_thread_stub(void*);
void* client_rcv_thread_stub(void*);
typedef struct position{
int lateral;
int distance;
int vertical;
};
typedef struct client_info{
int fd;
bool master;
char ip[20];
char name[100];
int video;
};
#ifndef NOQT
class Server: public QObject{
Q_OBJECT
#else
class Server{
#endif
public:
Server(int);
virtual ~Server();
int server_thread(void);
int getImage();
// client functions
int connectClient(int);
int send();
int sendImage(char *);
friend int receive_message(int);
friend void* server_rcv_thread_stub(void*);
friend void* client_rcv_thread_stub(void*);
rbTree<int> client_tree;
//Server( QObject *parent=0, const char *name=0 );
//#ifndef NOQT
signals:
void updateClientList();
//#endif
private:
static unsigned long int tid;
int port;
int newsockfd;
int newClientsockfd;
};
#endif //MYSOCKETS_H
To copy to clipboard, switch view to plain text mode
Bookmarks