How to use "QDbf" under Windows?

  • 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" ([url][/url]) 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:
    [CODE]definition of static data member 'QDbf::QDbfTableModel::staticMetaObjectExtraData' of dllimport'd class[/CODE]
    in "moc_dbftablemodel.cpp".

    My example-Code, I tried to compile is:

    [CODE]#include "qdbftable.h"
    #include "qdbfrecord.h"
    #include <QtGui>

    int main(int argv, char **args)

    QApplication app(argv, args);

    QTextEdit textEdit;;

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


    QString output;

    while ( {

    QDbf::QDbfRecord record = table.record();
    for (int i = 0; i < record.count(); ++i) {
              output.append(QLatin1String(": "));
              output.append(QLatin1String("; \n"));
           output.append(QLatin1String(": "));
           output.append(QLatin1String("; \r \n"));
    qDebug() << 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

  • Lifetime Qt Champion


    You don't need to copy anything.
    LIBS +=
    -LC:/PATH_TO_QDBF_DLL \ #<- This one without spaces would be best
    -lqdbf # have the correction name for debug/release builds
    And you should be good.

    Hope it helps

    [edit, code added]

    Thank you very much!!!

    But I had to avoid relative paths, only the absolute "C:/..." worked for me.

  • Lifetime Qt Champion

    I also prefer to use full paths, in that case I know exactly where the linker will look for the libs.

Log in to reply