cannot find qsqlodbc4 and QtCore



  • I transfer project from version 4 to 5. my experience with Qt is very small.
    when I build the project, i get errors:

    cannot find -lC:\Qt\5.5\mingw492_32/plugins/sqldrivers/qsqlodbc4
    cannot find -lc:/Qt/4.6.3/lib/QtCore
    error: ld returned 1 exit status

    TEMPLATE = app
    TARGET = monitor
    DESTDIR = ./Debug
    QT += network sql
    CONFIG += debug
    DEFINES += QT_XML_LIB QT_SQL_LIB QT_NETWORK_LIB
    INCLUDEPATH += ./GeneratedFiles \
        ./GeneratedFiles/Debug \
        . \
        ./release \
        ./debug \
        $(QTDIR)/mkspecs/win32-msvc2008
    LIBS += -L"$(QTDIR)/plugins/sqldrivers" \
        -l$(QTDIR)/plugins/sqldrivers/qsqlodbc4 \
        -lgdi32 \
        -lcomdlg32 \
        -loleaut32 \
        -limm32 \
        -lwinmm \
        -lwinspool \
        -lws2_32 \
        -lole32 \
        -luser32 \
        -ladvapi32 \
        -lmsimg32 \
        -lshell32 \
        -lc:/Qt/4.6.3/lib/QtCore \
        -lkernel32 \
        -luuid
    
    DEPENDPATH += .
    MOC_DIR += ./GeneratedFiles/debug
    OBJECTS_DIR += debug
    UI_DIR += ./GeneratedFiles
    RCC_DIR += ./GeneratedFiles
    
    #Include file(s)
    include(monitor.pri)
    
    #Windows resource file
    win32:RC_FILE = monitor.rc
    
    

    I tried correcting -lc: /Qt/4.6.3/lib/QtCore \ on -lc: /Qt/5.5/mingw492_32/lib/Qt5Core
    qsqlodbc4 on qsqlodbc.dll
    it exists in a folder C:\Qt\5.5\mingw492_32\plugins\sqldrivers
    pls help :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Some things that are looking suspicious in your .pro file:

    1. Why do you have the mkspecs path in your INCLUDEPATH ?
    2. Why do you have the path the the sqldrivers in your linker path list ?
    3. Why are you linking directly to QtCore and qsqlodbc4 ?
    4. Why are there so many Windows libraries in your LIBS list ? Unless you are using some Windows API directly all the libraries needed will get linked properly based on the Qt modules you are using.
    5. Why QT_XML_LIB QT_SQL_LIB QT_NETWORK_LIB in DEFINES ?
    6. Based on QT_XML_LIB, you are missing QT += xml


  • @SGaist said:

    Hi and welcome to devnet,

    Some things that are looking suspicious in your .pro file:

    1. Why do you have the mkspecs path in your INCLUDEPATH ?
    2. Why do you have the path the the sqldrivers in your linker path list ?
    3. Why are you linking directly to QtCore and qsqlodbc4 ?
    4. Why are there so many Windows libraries in your LIBS list ? Unless you are using some Windows API directly all the libraries needed will get linked properly based on the Qt modules you are using.
    5. Why QT_XML_LIB QT_SQL_LIB QT_NETWORK_LIB in DEFINES ?
    6. Based on QT_XML_LIB, you are missing QT += xml

    I did not write it because I do not know
    but i fixed .pro file:

    QT       += core gui network sql multimedia xml
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = monitor
    TEMPLATE = app
    CONFIG += debug
    DEFINES += QT_XML_LIB QT_SQL_LIB QT_NETWORK_LIB
    INCLUDEPATH += ./GeneratedFiles \
        ./GeneratedFiles/Debug \
        . \
        ./release \
        ./debug
    
    DEPENDPATH += .
    MOC_DIR += ./GeneratedFiles/debug
    OBJECTS_DIR += debug
    UI_DIR += ./GeneratedFiles
    RCC_DIR += ./GeneratedFiles
    
    #Include file(s)
    include(monitor.pri)
    
    #Windows resource file
    win32:RC_FILE = monitor.rc
    
    

    what do you say?

    and now I have new errors, i can create a new topic or add to this?)
    Qt5 minGW
    undefined reference to more_counter::more_counter(QDialog*)
    undefined reference to more_counter::setpParent(IPWindow*)
    undefined reference to more_counter::setName(QString)

    class that declares some private fields:

    more_counter* moredlg;
    etc.
    

    error occurs in lines:

           moredlg = new more_counter();
           moredlg->setpParent(this);
           moredlg->setName(master->deviceDescr.name);
           moredlg->iShow();
    

    class more_counter announced:
    ifdef / def / endif - exist

    class more_counter : public QDialog
    {
        Q_OBJECT
     
    public:
        more_counter(QDialog *parent = 0);
        ~more_counter();
     
    public:
        void iShow();
        void setpParent(IPWindow* prt);
        void setName(QString name);
     
    private:
        Ui::more_counter ui;
        
        IPWindow* parent;
        more_count* list;
        
        void GetData();
        void keyPressEvent(QKeyEvent *event);
            
    private slots:
        void on_pb_close_clicked();
        
    };
    In another header is:
    

    namespace Ui {
    class more_counter: public Ui_more_counter {};
    }
    I tried lot of options, but there is no result :(


  • Lifetime Qt Champion

    The DEFINES still don't make sense and unless you are generating headers as part of your build (which doesn't seem to be the case) There's no need of the paths added to INCLUDEPATH.

    The errors you are getting indicates that the class is not built.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.