Just a Qt Gui Application with QDialog as the Base Class, the simplest type you can expect. I've programmed on Qt for several times but this is the first time I meet this problem... I've added minimal code to the program, and here's the code in dialog.h (which is mostly automatically generated)
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QPixmap>
#include "bmp.h"
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
private slots:
void on_openButton_clicked();
private:
Ui::Dialog *ui;
BMP srcImage;
QImage compressedImage[3];
};
#endif // DIALOG_H
While I edit, the "public:" is underlined and says "unexpected token '('". When I try to build the program, it says in the line "Q_OBJECT", "error: expected ',' or '...' before numeric constant". I'm sure I've defined nothing related to it (to be exact, I defined an N and an n in file bmp.h, both are int).
Any idea of what's wrong here?
I think I've figured it out myself. I included some
#pragma pack(push)
#pragma pack(1)
//...
#pragma pack(pop)
in file "bmp.h". When I move the line
#include "bmp.h"
into file "dialog.cpp", everything works well
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.