HI
i am getting this error "error: ISO C++ forbids declaration of ‘-----’ with no type"
when do we get this error ??
Thnkx in advance...
HI
i am getting this error "error: ISO C++ forbids declaration of ‘-----’ with no type"
when do we get this error ??
Thnkx in advance...
Post some code.
Most likely you forgot a necessary forward declaration or include.
@fatjuicymole
mainwindow.h file.. i am getting the error in this code.
Qt Code:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QThread> #include <QMessageBox> #include <QtGui/QMainWindow> #include "sampleThread.h" namespace Ui { class MainWindow; } { Q_OBJECT public: ~MainWindow(); private: Ui::MainWindow *ui; sampleThread *newThread;//in this line }; #endif // MAINWINDOW_HTo copy to clipboard, switch view to plain text mode
Last edited by qtlinuxnewbie; 29th April 2010 at 13:12.
What is the contents of sampleThread.h?
Qt Code:
#ifndef SAMPLETHREAD_H #define SAMPLETHREAD_H #include <QMessageBox> #include <QThread> #include "mainwindow.h" { public: sampleThread(); void run(); QWidget *targetWidget; }; #endif // SAMPLETHREAD_HTo copy to clipboard, switch view to plain text mode
Your thread class in sampleThread.h... Is it really named 'Thread' or 'SampleThread' or 'sampleThread'.... The compiler does not know your 'Tread'.
Interrupted by a colleague. :-)
Try: samleThread *newThread;
Last edited by wysota; 29th April 2010 at 09:58.
actually it is sampleThread only
may be i was not clear for u .
it is
In the code you have posted, you use just "Thread", not "sampleThread".
i changed the posted code to sampleThread and tried to build but i am getting the same error.
You have a loop in your includes - mainwindow.h includes sampleThread.h which again includes mainwindow.h. Use a forward declaration in mainwindow.h instead of including sampleThread.h or don't include mainwindow.h in the other file.
Bookmarks