PDA

View Full Version : Problem using the QDbf Library under Windows



BlackMath
19th February 2013, 21:38
Hey guys,

I have to read out a .dbf-file (I know, it's very old, but the files are still used in this case and my App has to import them).
Via google, I have found the Library "QDbf" (http://code.google.com/p/qdbf/) and tested it under Mac OS X and everything works perfect.
Then, I tried to compile it under Windows (7) with MinGW, because the App will be mainly used under Windows. But I get lots of Warnings and a strange Error:

definition of static data member 'QDbf::QDbfTableModel::staticMetaObjectExtraData' of dllimport'd class
in "moc_dbftablemodel.cpp".

My example-Code, I tried to compile is:


#include "qdbftable.h"
#include "qdbfrecord.h"
#include <QtGui>

int main(int argv, char **args)
{

QApplication app(argv, args);

QTextEdit textEdit;
textEdit.show();

QDbf::QDbfTable table;
if (!table.open("datei.dbf")) {
qDebug() << "file open error";

}

QString output;

while (table.next()) {

QDbf::QDbfRecord record = table.record();
for (int i = 0; i < record.count(); ++i) {

if(!(record.value(i).toString().trimmed()==""))
{
if(record.fieldName(i)=="NAME")
{
output.append(record.fieldName(i));
output.append(QLatin1String(": "));
output.append(record.value(i).toString().trimmed() );
output.append(QLatin1String("; \n"));
}
if(record.fieldName(i)=="PRENAME")
{
output.append(record.fieldName(i));
output.append(QLatin1String(": "));
output.append(record.value(i).toString().trimmed() );
output.append(QLatin1String("; \r \n"));
}
}

}
qDebug() << output;
}

table.close();
textEdit.setText(output);

return app.exec();

}

The Header/Source-Files are in the same directory with the main.cpp.

And now my Questions:
- How do I import a class correctly in my Qt environment? Have the Lib to be integrated, or is it enough to copy it in the Dir with my other sourcefiles?
- Can I import it as a .dll? Because the Example in the QDbf-Package compiles correctly under Windows/MinGw and creates a .dll and .a-File. When I include it via "LIBS += ..." in my .pro-file, nothing happens. How do I include it correctly and use the functions of the dll in my Code?

Hope you can help me getting this to run! ;)

Greetings, Julian