Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Custom Designer Plugin with CMake ... builds but fails to load
Forum Updated to NodeBB v4.3 + New Features

Custom Designer Plugin with CMake ... builds but fails to load

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ryan0270
    wrote on last edited by
    #1

    I'm trying to build the example custom plugin using cmake. It builds just fine but Designer fails to load it with the following error:

    @
    "Cannot load library /usr/lib/qt/plugins/designer/libcustomwidgetplugin.so: (/usr/lib/qt/plugins/designer/libcustomwidgetplugin.so: undefined symbol: _ZTV17AnalogClockPlugin)"
    @

    I have made no changes to any source files, and I confirmed that the plugin works when built with QtCreator. Can someone help me figure out what I'm missing to make it work with cmake?

    Here's my CMakeLists.txt. It's got several redundant definitions in there right now from trying to copy what I saw in the Creator generated Makefile.

    @

    Standard setup cmake_minimum_required (VERSION 2.6)

    cmake_minimum_required (VERSION 2.6)
    project (customwidgetplugin CXX C)
    set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})

    FIND_PACKAGE(Qt4 REQUIRED)
    set (QT_USE_QTDESIGNER TRUE)
    set (QT_USE_QTGUI TRUE)
    INCLUDE(${QT_USE_FILE})
    ADD_DEFINITIONS(${QT_DEFINITIONS})
    ADD_DEFINITIONS(-DQT_PLUGIN)
    ADD_DEFINITIONS(-DQT_NO_DEBUG)
    ADD_DEFINITIONS(-DQT_SHARED)
    ADD_DEFINITIONS(-DQDESIGNER_EXPORT_WIDGETS)
    ADD_DEFINITIONS(-DQT_SCRIPT_LIB)
    ADD_DEFINITIONS(-DQT_XML_LIB)
    ADD_DEFINITIONS(-DQT_GUI_LIB)
    ADD_DEFINITIONS(-DQT_CORE_LIB)

    Includes

    set (includeDirs ${includeDirs}
    ${customwidgetplugin_SOURCE_DIR/src}
    )
    include_directories (${customwidgetplugin_SOURCE_DIR} ${includeDirs})

    Source files

    set (SRC ${SRC}
    src/analogclock.cpp
    src/customwidgetplugin.cpp
    )

    Headers

    set (H ${H}
    src/analogclock.h
    src/customwidgetplugin.cpp
    )

    set (FORMS ${FORMS}
    )

    set (LIBS ${LIBS}
    ${QT_LIBRARIES}
    -L/usr/lib -lQtScript -lQtXml -lQtGui -lQtCore -lQtDesigner -lpthread
    )

    set (RES ${RES})

    Create QT intermediates

    QT4_WRAP_CPP(H_MOC ${H})
    QT4_WRAP_UI(FORM_HEADERS ${FORMS})

    QT4_ADD_RESOURCES(RES_RCC ${RES})

    Executable

    add_library (customwidgetplugin SHARED ${SRC} ${H} ${H_MOC} ${FORM_HEADERS} ${RES_RCC})
    target_link_libraries (customwidgetplugin ${LIBS} ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES})
    install (TARGETS customwidgetplugin DESTINATION ${customwidgetplugin_BINARY_DIR} )
    @

    [EDIT: code formatting, please wrap in @-tags, not code; Volker]

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Duck
      wrote on last edited by
      #2

      With which compiler was your version of Qt Creator compiled, and which compiler did you use to compiler your designer plugin?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ryan0270
        wrote on last edited by
        #3

        Hmm, I didn't explicitly compile either. I'm using Arch linux and Designer came with the qt package (4.7.3) and I just installed Creator through the package manager.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved