May 3, 2012

pmjz pmjz
Lab Rat
60 posts

[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

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

3 replies

May 3, 2012

msx_br msx_br
Lab Rat
36 posts

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

 Signature 

msx_br - Brazil

May 3, 2012

pmjz pmjz
Lab Rat
60 posts

  1. QT       += core gui opengl sql xml
  2. CONFIG +=console
  3. TARGET = CrossSection
  4. TEMPLATE = app
  5. win32:RC_FILE += CrossSection.rc
  6.  
  7. SOURCES += main.cpp\
  8.     CrossSectionPresenter.cpp \
  9.     Bootstrapper.cpp \
  10.     CrossSectionView.cpp
  11.  
  12. HEADERS  += \
  13.     CrossSectionPresenter.h \
  14.     CrossSectionView.h \
  15.  
  16. INCLUDEPATH += ../ \
  17.     ../AppLibrary/ \
  18.     ../BusinessObjects/ \
  19.  
  20.  
  21. CONFIG(debug, debug|release){
  22. LIBS += \
  23.     -L../AppLibrary-build-desktop/debug -lAppLibrary \
  24.     -L../BusinessObjects-build-desktop/debug -lBusinessObjects
  25. }
  26.  
  27. CONFIG(release, debug|release){
  28. LIBS += \
  29.     -L../AppLibrary-build-desktop/release -lAppLibrary \
  30.     -L../BusinessObjects-build-desktop/release -lBusinessObjects
  31. }
  32.  
  33. RESOURCES += \
  34.     AppResources.qrc \
  35.     ../AppLibrary/Resources.qrc \
  36.     ../Logging/LoggingResources.qrc
  37.  
  38. OTHER_FILES += \
  39.     qt.conf \
  40.     CrossSection.rc

May 8, 2012

pmjz pmjz
Lab Rat
60 posts

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

  1. CONFIG(debug, debug|release){
  2. LIBS += \
  3.     -L../AppLibrary-build-desktop -lAppLibrary \
  4.     -L../BusinessObjects-build-desktop -lBusinessObjects
  5. }
  6.  
  7. CONFIG(release, debug|release){
  8. LIBS += \
  9.     -L../AppLibrary-build-desktop -lAppLibrary \
  10.     -L../BusinessObjects-build-desktop -lBusinessObjects
  11. }

 
  ‹‹ Bug with QGraphicsOpacityEffect probably?      JMS with Qt ››

You must log in to post a reply. Not a member yet? Register here!