Results 1 to 2 of 2

Thread: QMainWindow in a lib and dlopen/dlsym: RTTI symbol not found for class 'QWidget'

  1. #1
    Join Date
    Jul 2011
    Location
    Brasil
    Posts
    39
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QMainWindow in a lib and dlopen/dlsym: RTTI symbol not found for class 'QWidget'

    Hello there,

    I'm getting an "RTTI symbol not found for class 'QWidget'" (Debug) or a Segmentation fault (direct run) when running an application that makes an dlopen and an dlsym.

    In my library I have this:
    Qt Code:
    1. # define MHD(retType) extern "C" retType __attribute__((visibility("default")))
    2. MHD(QMainWindow *) newWindow(QWidget * parent){
    3. return new MainWindow(parent); //MainWindow is a QMainWindow subclass
    4. }
    To copy to clipboard, switch view to plain text mode 

    And in my application I have:
    Qt Code:
    1. typedef QMainWindow* (*newWindow_t)(QWidget*);
    2. void * dso=dlopen("libMHD.so", RTLD_NOW | RTLD_GLOBAL);
    3. nw=(newWindow_t)dlsym(dso, "newWindow");
    4. QMainWindow* mw=nw(this);
    5. mw->show();
    To copy to clipboard, switch view to plain text mode 

    With both projects open in QtCreator I am able to debug, and reach the constructor of MainWindow, then stepping into, I fall in a QFlag definition, then SIGSEGV...

    I need this to make an application open plugins... The idea is to have a function in each library that returns an std::vector containing all wrappers (I have a base class, and this one have a method const char* getKey(), so I can call a Factory to create new instances of each class using a string.).

    This is my first step, and I can't proceed...

    So, why, even with QT+= core gui, I'm getting such error?

    (Sorry English mistakes...)

    Thanks in advance.

  2. #2
    Join Date
    Jul 2011
    Location
    Brasil
    Posts
    39
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMainWindow in a lib and dlopen/dlsym: RTTI symbol not found for class 'QWidget'

    Aha!

    The problem is with the shadow build...
    I tried doing a qmake; make from konsole and everything works

    (I'm feeling little trolled by QtCreator... :P )

Similar Threads

  1. Replies: 1
    Last Post: 30th October 2010, 12:28
  2. Replies: 3
    Last Post: 8th August 2010, 10:53
  3. How to define class RTTI info macro?
    By lni in forum Qt Programming
    Replies: 5
    Last Post: 7th January 2010, 15:18
  4. QWidget on QMainWindow
    By jayreddy in forum Qt Programming
    Replies: 4
    Last Post: 6th January 2010, 08:27
  5. rtti() of derived class
    By quickNitin in forum Newbie
    Replies: 4
    Last Post: 8th October 2006, 14:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.