Results 1 to 3 of 3

Thread: Weird problem

  1. #1
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Weird problem

    I have the following code in file mainwindow.h:

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include "logindialog.h"
    6.  
    7. namespace Ui {
    8. class MainWindow;
    9. }
    10.  
    11. class MainWindow : public QMainWindow
    12. {
    13. Q_OBJECT
    14.  
    15. private:
    16. Ui::MainWindow *ui;
    17. LoginDialog *logindialog;
    18.  
    19. public:
    20. explicit MainWindow(QWidget *parent = 0);
    21. ~MainWindow();
    22.  
    23. private slots:
    24. void ALogin_Clicked();
    25. void LoginDialog_Destroyed();
    26.  
    27. };
    28.  
    29. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    Other related files:
    logindialog.cpp
    logindialog.h
    mainwindow.cpp

    Everything works fine, until I put ANY changes into logindialog.cpp file. When I do, I get the following error in line 17:

    Qt Code:
    1. c:\users\mati\komunikator_klient_da_ze\mainwindow.h:17: błąd:C2143: syntax error : missing ';' before '*'
    2. c:\users\mati\komunikator_klient_da_ze\mainwindow.h:17: błąd:C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    3. c:\users\mati\komunikator_klient_da_ze\mainwindow.h:17: błąd:C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    To copy to clipboard, switch view to plain text mode 

    The problem can easily be fixed, by removing line 17, recompliling the project (which gives even more errors) and then putting that line back. Everything will work fine, until I change logindialog.cpp again.
    While it doesn't make it impossible to continue the project, it makes it very annoying...
    The IDE I use is QtCreator 2.4.1

    Could someone please help me?

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Weird problem

    I don't know why you get that error. I have not experienced it before. I think this will help, though:

    In mainwindow.h dont use

    #include "LoginDialog.h"

    use

    class LoginDialog;


    use #include in the cpp
    Last edited by amleto; 23rd November 2012 at 20:56.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. The following user says thank you to amleto for this useful post:

    CactusPie (23rd November 2012)

  4. #3
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Weird problem

    Well, I'll be. Looks like that fixed the problem. I was almost certain that this problem will be too odd for anyone to know how to fix it Thanks a lot!!!

Similar Threads

  1. Weird problem with translate()
    By romariorios in forum Qt Programming
    Replies: 8
    Last Post: 27th July 2011, 20:31
  2. Weird problem with MainWindow
    By giusepped in forum Qt Programming
    Replies: 2
    Last Post: 24th July 2011, 12:17
  3. QFtp weird problem on windows
    By vcp in forum Qt Programming
    Replies: 0
    Last Post: 19th August 2009, 15:13
  4. Really weird problem with QHttp and MacOSX
    By NinoUzi in forum Newbie
    Replies: 1
    Last Post: 24th June 2009, 21:19
  5. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 07:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.