Qt-interest Archive, July 2007
Linker errors in Visual Studio
Message 1 in thread
Hi everyone,
I have a project I've ported from Qt3 to 4, using the qt3to4 tool, and I
feel like I'm almost there. I have some linker errors that I can't get rid
of however. They look like this:
SettingsDialog.obj : error LNK2001: unresolved external symbol "public:
virtual void * __thiscall SettingsDialog::qt_metacast(char const *)"
(?qt_metacast@SettingsDialog@@UAEPAXPBD@Z)
SettingsDialog.obj : error LNK2001: unresolved external symbol "public:
virtual struct QMetaObject const * __thiscall
SettingsDialog::metaObject(void)const "
(?metaObject@SettingsDialog@@UBEPBUQMetaObject@@XZ)
SettingsDialog.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const SettingsDialog::staticMetaObject"
(?staticMetaObject@SettingsDialog@@2UQMetaObject@@B)
SettingsDialog.obj : error LNK2019: unresolved external symbol "protected:
void __thiscall SettingsDialog::change(class QString const &)"
(?change@SettingsDialog@@IAEXABVQString@@@Z) referenced in function
"private: void __thiscall SettingsDialog::saveChanges(void)"
(?saveChanges@SettingsDialog@@AAEXXZ)
The header file (SettingsDialog.h) in question is short, and looks like
this:
#ifndef _SETTINGSDIALOG_H_
#define _SETTINGSDIALOG_H_
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qstringlist.h>
#include <qlayout.h>
class SettingsDialog
: public QDialog
{
Q_OBJECT
public:
SettingsDialog(QString fileName, QString pictureDir, QWidget *parent =
0, const char *name = 0); // constructor
~SettingsDialog(void); // destructor
signals:
void change(const QString &pic); // signal that is sent when clicked
private slots:
void saveChanges(); // saves the changes made in the dialog box
void enableSaveButton(const QString &text); // enables the save button
if there is text
private:
// private objects used in dialog box
QLabel *pictureLabel;
QLineEdit *pictureEdit;
QPushButton *saveButton;
QPushButton *cancelButton;
QString pictureDir;
};
#endif
As an example the saveChanges() function, as defined in SettingsDialog.cpp,
looks like this:
#include "SettingsDialog.h"
//Added by qt3to4:
#include <Q3VBoxLayout>
#include <Q3HBoxLayout>
#include <QLabel>
void SettingsDialog::saveChanges()
{
QString picText = pictureEdit->text();
emit change(picText);
}
Would anyone care to venture what's going on there? I'm able to moc
SettingsDialog.h from within Visual Studio, if that helps. Thanks for your
help.
--
[ signature omitted ]