PDA

View Full Version : Weird problem



CactusPie
23rd November 2012, 19:00
I have the following code in file mainwindow.h:


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "logindialog.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

private:
Ui::MainWindow *ui;
LoginDialog *logindialog;

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void ALogin_Clicked();
void LoginDialog_Destroyed();

};

#endif // MAINWINDOW_H

Other related files:
logindialog.cpp (http://pastebin.com/pGu8AkKn)
logindialog.h (http://pastebin.com/4QwBw87w)
mainwindow.cpp (http://pastebin.com/cQuYWkEj)

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



c:\users\mati\komunikator_klient_da_ze\mainwindow. h:17: błąd:C2143: syntax error : missing ';' before '*'
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
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


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?

amleto
23rd November 2012, 20:50
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

CactusPie
23rd November 2012, 21:37
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!!!