Hello all
I have an linking issue when compiling a programm under linux 32 bit that is using a dynamic library
My library is a class inheriting QObject and it has the Q_OBEJCT macro inside the classe.

The problem is that it says "undefined reference" to all signals I have for this class (and only the signals)
I suspect something I have to change in one or the other CMake but I can t find what even after googling.
I also suspect it would be due to the "Q_OBJECT" macro..

the cmake lists of the library is the following

Qt Code:
  1. cmake_minimum_required(VERSION 2.6)
  2. project(copy_playlist_backend)
  3. set(LIBRARY_OUTPUT_PATH lib)
  4. find_package(Qt4 REQUIRED)
  5. INCLUDE(${QT_USE_FILE})
  6.  
  7. ADD_DEFINITIONS(${QT_DEFINITIONS}) # I have added those four lines after googling but i am not sure what it does.....
  8. ADD_DEFINITIONS(-DQT_PLUGIN)
  9. ADD_DEFINITIONS(-DQT_NO_DEBUG)
  10. ADD_DEFINITIONS(-DQT_SHARED)
  11.  
  12. include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} include)
  13. SET (copy_playlist_backend_SRCS src/*)
  14. SET (copy_playlist_backend_HEADERS ../include/*)
  15.  
  16. file(GLOB_RECURSE source_files ${copy_playlist_backend_SRCS})
  17.  
  18. qt4_wrap_cpp(copy_playlist_backend_HEADERS_MOC ${copy_playlist_backend_HEADERS})
  19. qt4_automoc(${copy_playlist_backend_SRCS}${copy_playlist_backend_HEADERS_MOC})
  20.  
  21. add_library(copy_playlist_backend SHARED ${source_files} )
To copy to clipboard, switch view to plain text mode 

the cmake of the executable ist the following

Qt Code:
  1. cmake_minimum_required(VERSION 2.6)
  2. enable_language(CXX)
  3. PROJECT(Rainyday)
  4. FIND_PACKAGE(Qt4 REQUIRED)
  5. SET (QT_USE_QTXMLPATTERNS)
  6.  
  7. SET (project_name_VERSION_MAJOR 0) # The MAJOR version number.
  8. SET (project_name_VERSION_MINOR 1) # The MINOR version number
  9.  
  10. SET (CPB_INCLUDE /home/max/Documents/C/Library/copy_playlist_backend/include) #directory that contain the .h file of the library i want to link
  11.  
  12. INCLUDE_DIRECTORIES(${CPB_INCLUDE} ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${QT_QTXML_INCLUDE_DIR} ${QT_QTXMLPATTERNS_INCLUDE_DIR})
  13.  
  14. SET(Rainyday_SOURCES main.cpp mainwindow.cpp) # collect the sources of the project and call the collected set "project_name_SRCS"
  15. SET(Rainyday_HEADERS mainwindow.h ui_mainwindow.h)
  16. SET(Rainyday_FORMS mainwindow.ui)
  17. SET(Rainyday_RCCS playlist_ressource.qrc)
  18.  
  19. QT4_WRAP_CPP(Rainyday_HEADERS_MOC ${Rainyday_HEADERS})
  20. QT4_WRAP_UI(Rainyday_FORMS_HEADERS ${Rainyday_FORMS})
  21. QT4_ADD_RESOURCES(Rainyday_RCC_SRCS ${Rainyday_RCCS})
  22. INCLUDE(${QT_USE_FILE})
  23. ADD_DEFINITIONS(${QT_DEFINITIONS})
  24. LINK_DIRECTORIES(/home/max/Documents/C/Library/lib/) # Directory that contain the .so file
  25.  
  26. qt4_automoc(${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
  27. add_executable(Rainyday ${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
  28. target_link_libraries(Rainyday ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY} /home/max/Documents/C/Library/lib/libcopy_playlist_backend.so)
To copy to clipboard, switch view to plain text mode