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
cmake_minimum_required(VERSION 2.6)
project(copy_playlist_backend)
set(LIBRARY_OUTPUT_PATH lib)
find_package(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS}) # I have added those four lines after googling but i am not sure what it does.....
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} include)
SET (copy_playlist_backend_SRCS src/*)
SET (copy_playlist_backend_HEADERS ../include/*)
file(GLOB_RECURSE source_files ${copy_playlist_backend_SRCS})
qt4_wrap_cpp(copy_playlist_backend_HEADERS_MOC ${copy_playlist_backend_HEADERS})
qt4_automoc(${copy_playlist_backend_SRCS}${copy_playlist_backend_HEADERS_MOC})
add_library(copy_playlist_backend SHARED ${source_files} )
cmake_minimum_required(VERSION 2.6)
project(copy_playlist_backend)
set(LIBRARY_OUTPUT_PATH lib)
find_package(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS}) # I have added those four lines after googling but i am not sure what it does.....
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} include)
SET (copy_playlist_backend_SRCS src/*)
SET (copy_playlist_backend_HEADERS ../include/*)
file(GLOB_RECURSE source_files ${copy_playlist_backend_SRCS})
qt4_wrap_cpp(copy_playlist_backend_HEADERS_MOC ${copy_playlist_backend_HEADERS})
qt4_automoc(${copy_playlist_backend_SRCS}${copy_playlist_backend_HEADERS_MOC})
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
cmake_minimum_required(VERSION 2.6)
enable_language(CXX)
PROJECT(Rainyday)
FIND_PACKAGE(Qt4 REQUIRED)
SET (QT_USE_QTXMLPATTERNS)
SET (project_name_VERSION_MAJOR 0) # The MAJOR version number.
SET (project_name_VERSION_MINOR 1) # The MINOR version number
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
INCLUDE_DIRECTORIES(${CPB_INCLUDE} ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${QT_QTXML_INCLUDE_DIR} ${QT_QTXMLPATTERNS_INCLUDE_DIR})
SET(Rainyday_SOURCES main.cpp mainwindow.cpp) # collect the sources of the project and call the collected set "project_name_SRCS"
SET(Rainyday_HEADERS mainwindow.h ui_mainwindow.h)
SET(Rainyday_FORMS mainwindow.ui)
SET(Rainyday_RCCS playlist_ressource.qrc)
QT4_WRAP_CPP(Rainyday_HEADERS_MOC ${Rainyday_HEADERS})
QT4_WRAP_UI(Rainyday_FORMS_HEADERS ${Rainyday_FORMS})
QT4_ADD_RESOURCES(Rainyday_RCC_SRCS ${Rainyday_RCCS})
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
LINK_DIRECTORIES(/home/max/Documents/C/Library/lib/) # Directory that contain the .so file
qt4_automoc(${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
add_executable(Rainyday ${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
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)
cmake_minimum_required(VERSION 2.6)
enable_language(CXX)
PROJECT(Rainyday)
FIND_PACKAGE(Qt4 REQUIRED)
SET (QT_USE_QTXMLPATTERNS)
SET (project_name_VERSION_MAJOR 0) # The MAJOR version number.
SET (project_name_VERSION_MINOR 1) # The MINOR version number
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
INCLUDE_DIRECTORIES(${CPB_INCLUDE} ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${QT_QTXML_INCLUDE_DIR} ${QT_QTXMLPATTERNS_INCLUDE_DIR})
SET(Rainyday_SOURCES main.cpp mainwindow.cpp) # collect the sources of the project and call the collected set "project_name_SRCS"
SET(Rainyday_HEADERS mainwindow.h ui_mainwindow.h)
SET(Rainyday_FORMS mainwindow.ui)
SET(Rainyday_RCCS playlist_ressource.qrc)
QT4_WRAP_CPP(Rainyday_HEADERS_MOC ${Rainyday_HEADERS})
QT4_WRAP_UI(Rainyday_FORMS_HEADERS ${Rainyday_FORMS})
QT4_ADD_RESOURCES(Rainyday_RCC_SRCS ${Rainyday_RCCS})
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
LINK_DIRECTORIES(/home/max/Documents/C/Library/lib/) # Directory that contain the .so file
qt4_automoc(${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
add_executable(Rainyday ${Rainyday_SOURCES} ${Rainyday_HEADERS_MOC} ${Rainyday_RCC_SRCS} ${Rainyday_FORMS_HEADERS} ${Rainyday_FORMS} )
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
Bookmarks