Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7696933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:53:43+00:00 2026-05-31T21:53:43+00:00

Just a Qt Gui Application with QDialog as the Base Class, the simplest type

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:53:45+00:00Added an answer on May 31, 2026 at 9:53 pm

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

with GUI apps I mean not just a Unix command line application, but the
I have a thick GUI application (possibly running as a service, but also just
I've just started on a GUI application which will feature several distinct modes and
I wanted to do a simple GUI application in VC++ but can't find any
I just noticed the memory usage of a simple win32 C based GUI application
I just installed Glassfish on my Ubuntu server (No GUI) using THIS tutorial. Everything
I have just made my first proper little desktop GUI application that basically wraps
Requirements I want to publish a Java GUI application on Windows 7. This application
I'm creating a GUI application that can monitor and manipulate a stream of messages.
I'm working on a flexible GUI application that can have ~12 varied layouts. These

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.