Important: Please read the Qt Code of Conduct -

[Solved]Link error

  • Hi guys,

    I build my project and finally whole batch of errors like below appeared, looks like linking has some problems, by the way, I run C++ project on ubuntu 64bit OS. and I installed 64bits OS on my 32Bit computer

    welcome any idea

    @main.o: In function neoseis::BusinessObject::setCurrentUser(QString const&)': /home/administrator/QtProjects/Source/Trunk/CrossSection-build-desktop/../../Trunk/AppLibrary/models/BusinessObject.h:59: undefined reference toneoseis::BusinessObject::m_currentUser'
    CrossSectionPresenter.o: In function CrossSectionPresenter': /home/administrator/QtProjects/Source/Trunk/CrossSection-build-desktop/../CrossSection/CrossSectionPresenter.cpp:101: undefined reference toneoseis::ScrollViewPresenter::ScrollViewPresenter(QString const&, neoseis::View2D*)'
    /home/administrator/QtProjects/Source/Trunk/CrossSection-build-desktop/../CrossSection/CrossSectionPresenter.cpp:104: undefined reference to `neoseis::Presenter2D::view() const'@

  • The information provided is not enough to help you.

    But ins most cases you need to add to your .pro file:

    In case of linking problem regarding one internal ( made by you ) function, you
    must include the .ccp file ( BusinessObject and Presenter2D ).

    In case of 3rd party library, you must include the .lib ( or .a ) in your .pro file

  • @QT += core gui opengl sql xml
    CONFIG +=console
    TARGET = CrossSection
    TEMPLATE = app
    win32:RC_FILE += CrossSection.rc

    SOURCES += main.cpp

    HEADERS +=
    CrossSectionView.h \

    INCLUDEPATH += ../
    ../BusinessObjects/ \

    CONFIG(debug, debug|release){
    LIBS +=
    -L../AppLibrary-build-desktop/debug -lAppLibrary
    -L../BusinessObjects-build-desktop/debug -lBusinessObjects

    CONFIG(release, debug|release){
    LIBS +=
    -L../AppLibrary-build-desktop/release -lAppLibrary
    -L../BusinessObjects-build-desktop/release -lBusinessObjects



  • thanks a lot, the problem is fixed because of the wrong place where I put .o in. the solution is just to remove the subfolder of the debug and release
    @CONFIG(debug, debug|release){
    LIBS +=
    -L../AppLibrary-build-desktop -lAppLibrary
    -L../BusinessObjects-build-desktop -lBusinessObjects

    CONFIG(release, debug|release){
    LIBS +=
    -L../AppLibrary-build-desktop -lAppLibrary
    -L../BusinessObjects-build-desktop -lBusinessObjects

Log in to reply