Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. undefined error when drived from QAbstractItemViewPrivate
Qt 6.11 is out! See what's new in the release blog

undefined error when drived from QAbstractItemViewPrivate

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 439 Views
  • 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.
  • T Offline
    T Offline
    thomas.sksksks
    wrote on last edited by
    #1

    Hi experts,

    I am trying to do a CustomTreeView derived from QAbstractItemView with CustomTreeViewPrivate derived from QAbstractItemViewPrivate.
    Here is my project

    ---
    CustomTreeView.pro
    ----
    QT   += gui widgets core widgets-private gui-private core-private
    
    SOURCES += main.cpp\
            mainwindow.cpp \
        CustomTreeView.cpp 
    
    HEADERS  += mainwindow.h \
        CustomTreeView.h \
        CustomTreeView_p.h
    
    
    ------
    ------------------------------------------------------------
    -----
    CustomTreeView_p.h
    -----
    class CustomTreeViewPrivate: public QAbstractItemViewPrivate {
    ...
    }
    
    ------
    ------------------------------------------------------------
    -----
    CustomTreeView.h
    -----
    class CustomTreeView: public QAbstractItemView {
    Q_OBJECT
    public:
    CustomTreeView(QWidget* parent) : QAbstractItemView (*new CustomTreeViewPrivate,  parent) {
    ...
    }
    ...
    ...
    }
    
    

    When compiling the project, it reports a lot "undefined symbol error" like below
    error: undefined symbol: QAbstractItemViewPrivate::QAbstractItemViewPrivate
    error: undefined symbol: QAbstractItemViewPrivate::~QAbstractItemViewPrivate
    .....

    Do you know how to fix these errors ?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Private symbols are not exported by the pre-compiled Qt libraries. You need to compile Qt yourself either:

      • defining QT_BUILD_INTERNAL (i.e use the -developer-build configure option) to export private symbols
      • build Qt as a static library (i.e use the -static configure option)

      QT += *-private only deals with the headers, it can't export more symbols

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3

      • Login

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