firebird database - ibpp



  • hi,
    I'm starting to code with qt and firebird
    I decided to use IBPP for connecting qt application with firebird db on windows 10
    after including ibpp.h in my project and after trying to build it I get the following errors:
    error1:
    C:\Users\jozol\OneDrive\APP-DEMO\qtFB\ibpp-core\ibpp.h:875: error: undefined reference to `IBPP::DatabaseFactory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

    error2:
    collect2.exe:-1: error: error: ld returned 1 exit status
    could you please help me on this?
    thanks



  • Did you include de LIB in your .pro?

    
    win32{
      LIBS += -L<path to lib> -lfbclient_ms -ladvapi32
      DEFINES += IBPP_WINDOWS
    }
    
    
    


  • not this way you showed, thanks for this one...
    but now, new error emerged: :-1: error: [release\qtFB.exe] Error 1
    Makefile.Release:69: recipe for target 'release\qtFB.exe' failed
    mingw32-make[1]: Leaving directory 'C:/Users/jozol/OneDrive/APP-DEMO/build-qtFB-Desktop_Qt_5_8_0_MinGW_32bit-Profile'
    mingw32-make[1]: *** [release\qtFB.exe] Error 1
    Makefile:34: recipe for target 'release' failed
    mingw32-make: *** [release] Error 2
    21:56:37: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project qtFB (kit: Desktop Qt 5.8.0 MinGW 32bit)
    When executing step "Make"
    21:56:37: Elapsed time: 00:01.

    any suggestions please


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should post the actual error, this is just the end of the log and not the most useful information can be extracted from that part.



  • Hi,
    This is how my .pro file looks now.
    It compiles...
    Thanks a lot

    QT += core gui sql¸
    SOURCES += main.cpp
    mainview.cpp

    HEADERS += mainview.h
    ibpp-core/_ibpp.h
    ibpp-core/ibase.h
    ibpp-core/iberror.h
    ibpp-core/ibpp.h

    FORMS += mainview.ui

    #IBPP
    win32 {
    LIBS += -LC:/Firebird/Firebird_3_0/lib -lfbclient_ms -ladvapi32
    DEFINES += IBPP_WINDOWS
    #LIBS += -lfbclient_ms
    }
    INCLUDEPATH += c:/Firebird/Firebird_3_0/include

    #C++ flags
    CONFIG += c++11
    CONFIG += c++14


  • Lifetime Qt Champion

    Which version of Qt are you using ? If above or equal 5.7, you can safely remove the C++XX config values. A C++11 able compiler is mandatory since 5.7. qmake should choose the latest standard available.

    And again, please post a more complete error log.



  • I'm using qt 5.8
    Here is the content of .cpp, .h and .pro files, and text of error:
    //qt pro file
    #-------------------------------------------------

    Project created by QtCreator 2017-04-12T23:31:36

    #-------------------------------------------------

    QT += core gui sql

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = qtfb2
    TEMPLATE = app

    The following define makes your compiler emit warnings if you use

    any feature of Qt which as been marked as deprecated (the exact warnings

    depend on your compiler). Please consult the documentation of the

    deprecated API in order to know how to port your code away from it.

    DEFINES += QT_DEPRECATED_WARNINGS

    You can also make your code fail to compile if you use deprecated APIs.

    In order to do so, uncomment the following line.

    You can also select to disable deprecated APIs only up to a certain version of Qt.

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    SOURCES += main.cpp
    mainview.cpp

    HEADERS += mainview.h
    ibpp-core/_ibpp.h
    ibpp-core/ibase.h
    ibpp-core/iberror.h
    ibpp-core/ibpp.h

    FORMS += mainview.ui

    #IBPP
    win32 {
    LIBS += -LC:/Firebird/Firebird_3_0/lib
    LIBS += -lAdvapi32 -lfbclient_ms
    DEFINES += IBPP_WINDOWS
    DEFINES += MBCS
    DEFINES -= -UNICODE
    QMAKE_CXXFLAGS += -DIBPP_WINDOWS

    #LIBS += -LC:/Firebird/Firebird_2_5/lib
    }
    INCLUDEPATH += c:/Firebird/Firebird_3_0/include

    #C++ flags
    #CONFIG += c++11
    #CONFIG += c++14

    //mainview.cpp
    #include "mainview.h"
    #include "ui_mainview.h"
    #include <iostream>
    #include <string>
    #include <QDebug>
    #include "ibpp-core/ibpp.h"

    using namespace IBPP;
    using namespace std;

    MainView::MainView(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainView)
    {
    ui->setupUi(this);
    db=IBPP::DatabaseFactory(serverName,dbName,userName, password);
    }

    MainView::~MainView()
    {
    delete ui;
    }

    //mainview.h
    #ifndef MAINVIEW_H
    #define MAINVIEW_H

    #include <QMainWindow>
    #include <string>
    #include "ibpp-core/ibpp.h"
    #include "ibpp-core/_ibpp.h"
    using namespace IBPP;
    using namespace std;

    namespace Ui {
    class MainView;
    }

    class MainView : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainView(QWidget *parent = 0);
    ~MainView();

    private:
    Ui::MainView ui;
    Database db;
    const string dbName = "C:/Firebird/Firebird_3_0/examples/JLEKOTEST.FDB";
    const string serverName = "localhost";
    const string userName = "SYSDBA";
    const string password = "
    ***";
    };

    #endif // MAINVIEW_H

    //qt issues
    mainview.obj:-1: error: LNK2019: unresolved external symbol "class IBPP::Ptr<class IBPP::IDatabase> __cdecl IBPP::DatabaseFactory(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?DatabaseFactory@IBPP@@YA?AV?$Ptr@VIDatabase@IBPP@@@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@000000@Z) referenced in function "class IBPP::Ptr<class IBPP::IDatabase> __cdecl IBPP::DatabaseFactory(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?DatabaseFactory@IBPP@@YA?AV?$Ptr@VIDatabase@IBPP@@@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@000@Z)

    debug\qtfb2.exe:-1: error: LNK1120: 1 unresolved externals

    //compile output
    11:36:38: Running steps for project qtfb2...
    11:36:38: Configuration unchanged, skipping qmake step.
    11:36:38: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe"
    C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -DIBPP_WINDOWS -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\qtfb2.vc.pdb -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DIBPP_WINDOWS -DMBCS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I..\qtfb2 -I. -Ic:\Firebird\Firebird_3_0\include -IC:\Qt\5.8\msvc2015_64\include -IC:\Qt\5.8\msvc2015_64\include\QtWidgets -IC:\Qt\5.8\msvc2015_64\include\QtGui -IC:\Qt\5.8\msvc2015_64\include\QtANGLE -IC:\Qt\5.8\msvc2015_64\include\QtSql -IC:\Qt\5.8\msvc2015_64\include\QtCore -Idebug -I. -IC:\Qt\5.8\msvc2015_64\mkspecs\win32-msvc2015 -Fodebug\ @C:\Users\jozol\AppData\Local\Temp\mainview.obj.3512.15.jom
    mainview.cpp
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:debug\qtfb2.exe @C:\Users\jozol\AppData\Local\Temp\qtfb2.exe.3512.3015.jom
    mainview.obj : error LNK2019: unresolved external symbol "class IBPP::Ptr<class IBPP::IDatabase> __cdecl IBPP::DatabaseFactory(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?DatabaseFactory@IBPP@@YA?AV?$Ptr@VIDatabase@IBPP@@@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@000000@Z) referenced in function "class IBPP::Ptr<class IBPP::IDatabase> __cdecl IBPP::DatabaseFactory(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?DatabaseFactory@IBPP@@YA?AV?$Ptr@VIDatabase@IBPP@@@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@000@Z)
    debug\qtfb2.exe : fatal error LNK1120: 1 unresolved externals
    jom: C:\Users\jozol\OneDrive\APP-DEMO\build-qtfb2-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\qtfb2.exe] Error 1120
    jom: C:\Users\jozol\OneDrive\APP-DEMO\build-qtfb2-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile [debug] Error 2
    11:36:41: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
    Error while building/deploying project qtfb2 (kit: Desktop Qt 5.8.0 MSVC2015_64bit)
    The kit Desktop Qt 5.8.0 MSVC2015_64bit has configuration issues which might be the root cause for this problem.
    When executing step "Make"
    11:36:41: Elapsed time: 00:03.


  • Lifetime Qt Champion

    Are you sure you are linking to all the required libraries ?



  • @SGaist I'm not sure, if you have a suggestion please be my guest...


  • Lifetime Qt Champion

    For which version of MSVC are your Firebrid libraries compiled ?

    What about ib_util_ms.lib ?



  • @SGaist
    Hi, I reinstalled Qt with MinGW, included ib_util_ms.lib and error looks like this:

    22:05:37: Running steps for project qtfb2...
    22:05:37: Configuration unchanged, skipping qmake step.
    22:05:37: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
    C:\Qt\5.8\mingw53_32\bin\qmake.exe -o Makefile ..\qtfb2\qtfb2.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
    C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Users/jozol/OneDrive/APP-DEMO/build-qtfb2-Desktop_Qt_5_8_0_MinGW_32bit-Debug'
    g++ -Wl,-subsystem,windows -mthreads -o debug\qtfb2.exe debug/main.o debug/mainview.o debug/moc_mainview.o  -lmingw32 -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libqtmaind.a -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -lshell32 -LC:\Firebird\Firebird_3_0\lib -LC:\Firebird\Firebird_3_0\WOW64\lib -lAdvapi32 -lfbclient_ms -lib_util_ms C:\Qt\5.8\mingw53_32\lib\libQt5Widgetsd.a C:\Qt\5.8\mingw53_32\lib\libQt5Guid.a C:\Qt\5.8\mingw53_32\lib\libQt5Sqld.a C:\Qt\5.8\mingw53_32\lib\libQt5Cored.a 
    debug/mainview.o: In function `ZN4IBPP15DatabaseFactoryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_S7_':
    C:\Users\jozol\OneDrive\APP-DEMO\build-qtfb2-Desktop_Qt_5_8_0_MinGW_32bit-Debug/../qtfb2/ibpp-core/ibpp.h:875: undefined reference to `IBPP::DatabaseFactory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:69: recipe for target 'debug\qtfb2.exe' failed
    mingw32-make[1]: *** [debug\qtfb2.exe] Error 1
    mingw32-make[1]: Leaving directory 'C:/Users/jozol/OneDrive/APP-DEMO/build-qtfb2-Desktop_Qt_5_8_0_MinGW_32bit-Debug'
    Makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    22:05:39: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project qtfb2 (kit: Desktop Qt 5.8.0 MinGW 32bit)
    When executing step "Make"
    22:05:39: Elapsed time: 00:03.
    

    When I comment this line in .cpp file
    // db=IBPP::DatabaseFactory(serverName,dbName,userName, password);
    no error occures...
    I really don't know what to do...I read on internet that this could be encoding problem, but I'm newb and it is little bit complex for me...
    Regards.


  • Lifetime Qt Champion

    Again: which compiler was used to build your IBPP libraries ? It's really important on Windows since you can't mix and match compilers. Only VS2017 is compatible with VS2015.



  • @SGaist
    Where can I see that?
    I'm including only ibpp.h file in my project, no ibpp library file.


  • Lifetime Qt Champion

    Check the content of your package, README file etc. You can run Dependency Walker.



  • Checking the ZIP file contentes from https://www.firebirdsql.org/en/firebird-3-0-2/. Firebird is using MS compiler.

    So, do not use MingW.



  • Is there a way around this?
    Compilig a qibase driver maybe...


  • Lifetime Qt Champion

    A way around what ?



  • IBPP does not work with firebird3, I tried it with 2.5 and it works Ok.....


Log in to reply