main.obj : error LNK2019

Crash123

Erfahrenes Mitglied
Hallo Leute,

ich habe folgenden Error beim einbinden einer Klasse aus einem anderen Projekt:
(Ich Programmiere in QT)

"main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall Dictionary::Dictionary(class QString)" (****0Dictionary@@QAE@VQString@@@Z)" in Funktion "_main"."

Weiß jemand was ich falsch mache :-D

Der Code wie Folgt:

Code:
#include "auswertung.h"
#include <QtGui/QApplication>

#include <Dictionary.h>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	auswertung w;

	QString bla("D:/test_Dictionary.dic");

	Dictionary * dic = new Dictionary(bla);

	w.show();
	return a.exec();
}

Der Header von Dictionary:

Code:
#pragma once

/*
*	A Dictionary class
*	contains a list of all words and their pronounciations
*	contains a list of entries in the dictionary called "lines"
*	contains a list of all phones in the Dictionary and their probabilitys
*/

#include <qhash.h>
#include <qstringlist.h>

#include <QTime>

#include <qfile.h>
#include <qiodevice.h>
#include <qtextstream.h>

#include "Phonem.h"

class Dictionary
{
public:
	Dictionary(QString path);
	~Dictionary(void);

	QString getPath();
	void setPath(QString path);

	QStringList getRandomWords();

	QStringList getWordLines();
	QStringList getPhoneLines();
	QStringList getPhoneStrings();
	QList<Phonem*> getPhoneme();
	int indexOfPhonem(QString phone);
	int indexOfPhonem(Phonem * phone);
	Phonem * getPhonemAt(int index);

	QStringList getLines();

	QHash<QString, QString> getWord2PhoneMap();
	QHash<QString, QString> getPhone2WordMap();

	int add(QString word, QString phone);
	bool addLine(QString line);

	void mkPhones();
	void setDicIsFinish(bool isFinish);
	Phonem * getPhone2Graphem(WordPart * part);
	Phonem * getPhone2Graphem(QString part);
	double getProbability(WordPart * graphem, QString phonem);
	double getProbability(WordPart * graphem, Phonem * phonem);

	void restore();
	void flush();
	void close();

	static QStringList	WHITE_SPACES,	//a list of all space chars and the empty String
						DISCONNECTORS;	//a list of some disconnectors in the Dictionary between Graphem- and Phonemgroup

	static int MIN_RAND_WORDS			//min number of random words to generate
			 , MAX_RAND_WORDS;			//max number of random words to generate

private:
	bool isFinish;						//if it´s true there is no way to restore the Dictionary

	QString path;
	QString disconnector;				//the disconnector betwenn graphem- and phonemgroup to save

	QFile * dic;

	QStringList lines;
	QStringList backUp;
	QStringList words;					//list of graphemgroups- 1:1 to phoneLines
	QStringList phoneLines;				//list of phonemgroups - 1:1 to words

	QStringList phoneStrings;			//list of all phones as String
	QList<Phonem*> phones;				//list of all phones as member form type Phonem

	QHash<QString, QString> word2phone;	//mapped graphemgroup to phonegroup
	QHash<QString, QString> phone2word; //mapped phonegroup to graphemgroup
};

Vielen Dank in Vorraus.
 
EDIT:
Danke für die schnellle Antwort.

Dann müsste ich auch alle folge *.cpp dateien hinzufügen und dann kann ich das gesamte Projekt rein kopieren

Wie kann ich denn ein vorhandenes Projekt als Bibliothek compilieren? ...
 
Visual Studio 2010
Qt 4.8.5

Ich habe in den Projekt-Properties schon die Target Einstellung
Dynamik Bibliothek (.dll) gefunden, aber bekomm beim erstellen
einen Fehler, dass er die '.dll nicht finden kann ... was keinen Sinn
ergibt, weil er sie ja erstellen soll ... ich denk mal ich lieg noch
immer falsch

EDIT:

Ich habe es nun geschafft eine *.dll zuerstellen ...
das Problem war, dass die OUTPUT-Datei-Endung exe war und nicht dll ...
 
Zuletzt bearbeitet:
Hallo,

möchtest du wirklich die *.dll erstellen, oder nur dein Programm kompilieren?

Falls letzteres, dann füge die notwendigen Qt *.libs bei den Linkereinstellungen in deinen Projekteinstellungen ein, sowie den Pfad zu den "Qt/4.8.5/lib". Dann reicht es nämlich aus die *.dlls, die das Programm wünscht, in den Systempfad hinzuzufügen oder in den Ordner deiner *.exe zu kopieren.

Grüße,
Jennesta

P.S.: Ich kann dir sehr das VS2010 AddIn von Qt empfehlen. Das macht die Arbeit damit deutlich einfacher, da durch die Projektwizards, diese Linkereinstellungen automatisch vorgenommen werden.
 
Zurück