2 Attachment(s)
error: expected class-name before "{" token
I'm getting this compile-time error pointing to the widget class that I inherited from QWidget. I only recycled the previous code I was using I don't know why I'm getting this error.
In the file included from main.cpp:2:
webcam.h:13: error: expected class-name before "{" token
Attached are the files main.cpp and webcam.h
Re: error: expected class-name before "{" token
Both QWidget and Ui::webcam are QObject children while you can inherit from 1 QObject only (inheritance from multiple QObject's will not work ). You can try to encapsulate Ui::webcam as member.
Re: error: expected class-name before "{" token
So here's what I came up with my webcam.h:
Code:
#ifndef WEBCAM_H
#define WEBCAM_H
#include <QWaitCondition>
#include <QWidget>
#include "ui_webcam.h"
class CapturingThread;
class ImageBuffer;
class RenderingThread;
class WebcamWidget
: public QWidget{
Q_OBJECT
public:
~WebcamWidget();
protected:
private slots:
void startThreads();
void haltThreads();
void updatePixmap(QImage& image);
private:
Ui::webcam ui;
CapturingThread* capturingThread;
ImageBuffer* imageBuffer;
RenderingThread* renderingThread;
};
#endif
This time, flagged me 2 errors.
error: using-declaration for non-member at class scope
error: expected ";" before "ui"
Re: error: expected class-name before "{" token
Explore/show ui_webcam.h file. Imho there is no Ui::webcam class.
Re: error: expected class-name before "{" token
Or it should be something like:
Re: error: expected class-name before "{" token
Quote:
Originally Posted by
Rembobo
Explore/show ui_webcam.h file. Imho there is no Ui::webcam class.
So I see. I didn't name the Ui webcam it was Ui::camWidget. This is what flagged me the error. Thanks.