PDA

View Full Version : Errors



hgedek
23rd November 2007, 08:58
I couldnt solve this problems.I added Q_OBJECT.But I again got these...
programeditor.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall ProgramEditor::metaObject(void)const " (?metaObject@ProgramEditor@@UBEPBUQMetaObject@@XZ)
programeditor.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ProgramEditor::qt_metacast(char const *)" (?qt_metacast@ProgramEditor@@UAEPAXPBD@Z)
programeditor.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ProgramEditor::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@ProgramEditor@@UAEHW4Call@QMetaObjec t@@HPAPAX@Z)
programeditor.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall ProgramEditor::MyShow(void)" (?MyShow@ProgramEditor@@MAEXXZ)
programeditor.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall ProgramEditor::MyHide(void)" (?MyHide@ProgramEditor@@MAEXXZ)
programeditor.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ProgramEditor::staticMetaObject" (?staticMetaObject@ProgramEditor@@2UQMetaObject@@B )

DeepDiver
23rd November 2007, 09:28
The moc generated files are missing.
Please use qmake to create your project.

http://doc.trolltech.com/4.3/qmake-manual.html

hgedek
23rd November 2007, 10:09
I know.That is not my first project.
I created project again and again.I controlled error:I think problem is that:
My programEditor.h programList.h .... include Q_OBJECT.Afted qmake I can create moc files for all except programEditor.h.So above problems occur.
That is programEditor.h



#ifndef PROGRAMEDITOR_H
#define PROGRAMEDITOR_H

#include "abstractClass.h"
#include "Program.h"
#include "ProgramList.h"
#include "MyStyle.h"

#include <QKeyEvent>
#include <QString>
#include <QShowEvent>
#include <QMenu>
#include <QAction>
#include <QListWidgetItem>
#include <QCloseEvent>

#include "ui_programEditor.h"
#include "ui_listDialog.h"
#include "ui_commandEditor.h"
#include "ui_setPoints.h"

#define PARALLEL "parallel"
#define MAIN "main"

using namespace Ui;

class ProgramEditor :public AbstractClass
{
Q_OBJECT
public:
ProgramEditor(QWidget *parent=0);
~ProgramEditor();
void Show();

private:
int programIndex;
ProgramList *programlist;
Program myProgram;
QVector<QTreeWidgetItem *> treeItem;
QVector<QTreeWidgetItem *> treeSubItem;
QVector<QListWidgetItem *> groupItem;
QVector<QListWidgetItem *> commandItems;

QMenu *menu;
QAction *changeSetPoint;
MyStyle *mystyle;

void ProgramDialog();
void ShowProgramList();
void DeleteProgramList();
void CreateProgramEditor();
void CreateTreeWidget();
void CreatePointMenu(int indexOfStep ,int indexOfComm);
void TreeWidgetFocus();
void CreateMenus();
void CreateCommandEditor(QDialog *dialog);
void CreateSetPointEditor(QDialog *dialog);
void DeleteDialog();
void CloseInputWidget();

UIProgramEditor *UIeditor;
UIListDialog *UIprogramDialog;
UICommandEditor *UIcommandEditor;
UISetPoint *UIsetPoint;

//SetPoint Menu kısmı

QStringList CommandList;

protected:
void keyPressEvent(QKeyEvent *event);
void showEvent(QShowEvent *event);
//void closeEvent(QCloseEvent *event);

bool event(QEvent *e);

public slots:
void GetIndex(int index);
void TreeWidgetItemChanged(QTreeWidgetItem *,QTreeWidgetItem *);
void ShowCommandEditor();
int ShowSetPointEditor();
signals:
void MyShow();
void MyHide();

};

#endif

jacek
23rd November 2007, 12:25
Does AbstractClass inherit QObject?

hgedek
23rd November 2007, 13:09
#ifndef ABSTRACTCLASS_H_
#define ABSTRACTCLASS_H_

#include <QWidget>

class AbstractClass : public QWidget
{
public:
AbstractClass(QWidget *parent)
:QWidget(parent){}
virtual void Show()=0;
};
#endif

jacek
23rd November 2007, 13:43
Is programEditor.h listed in HEADERS variable in your .pro file?

hgedek
23rd November 2007, 23:26
yes.It is listed.

jacek
25th November 2007, 23:21
Do you have only one .pro file? Do you SUBDIRS template?