Unsolved [Error] undefined symbol: _ZN7QWidget8qwsEventEP8QWSEvent
-
You also have an Ubuntu 14.04 running on your target ? If so, then you have a classic "desktop like" build of Qt on your target. That's why it can find the symbols related to QWS. Either rebuild your Qt without the embedded option or install your cross-compiled Qt on the target.
-
No, my target use Angstrom os, which was distributed with board
-
Then check how Qt was built for Angstrom but I suspect that it's a desktop like build rather than an embedded.
-
I found cause of this error, but i dont know how to solve it. That is:
when create new project on Qt(Ctr+N). Qt automatically create new class called mainwindow
and automatically create code in main.cpp which show mainwindow. in main.cpp:
MainWindow w;
w.show();
if build, then run, this error raised
but i replace this two command in main.cpp as following:
...
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);QMainWindow q; q.show(); return a.exec();
}
it run ok.
we see that mainwindow class inherite from QMainWindow class.
when show QMainWindow is ok, but show mainwindow is not ok
that isn't understand -
Do you do something special in MainWindows constructor?
-
No, Qt automatically create it. i don't change ever
-
Silly question but, are you using the same kit for both projects ?
-
yes, I use same kit for two
-
Then as @jsulm asked, what are you doing in your MainWindow class that differs it from QMainWindow ?
-
i don't change anything, MainWindow class is created automatically by Qt creator
let me post code here. i can't find how to attach it
mainwindow.h content:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_HMainwindow.cpp content:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
} -
Then there must be something else with your project.
-
I created C++ class manually, this class calls abc and inherited from QMainWindow class
source code of abc.h:#ifndef ABC_H #define ABC_H #include <QMainWindow> class abc : public QMainWindow { Q_OBJECT public: explicit abc(QWidget *parent = 0); signals: public slots: }; #endif // ABC_H
source code of abc.cpp:
#include "abc.h" abc::abc(QWidget *parent) : QMainWindow(parent) { }
source of main.cpp:
#include "mainwindow.h" #include <QApplication> #include "abc.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // MainWindow w; // w.show(); // QMainWindow q; // q.show(); abc abc1; abc1.show(); return a.exec(); }
when app run on beagbone black, this error still rises
-
There's something illogical here so lets try to summaries things:
First case:- You create a default widget project with Qt Creator
- Replace the MainWindow call in main.cpp by a QMainWindow
- Build it with your cross-compiled Qt
- Runs on BBB
Second case:
- You create a default widget project with Qt Creator
- You keep the MainWindow class
- Build it with your cross-compiled Qt
- Fails to run on BBB complaining about QWS
In both case, you use the exact same version of Qt to build (i.e. cross-compile) the projects.
Is the summary correct ?
-
yes, you are right. but you miss the third case.
because i have three cases.
the third case:- I create a default widget project with Qt Creator
- I create a new class (name is ABC) which inherite from QMainWindow (source code I posted at #21)
- Replace the MainWindow class in main.cpp by ABC class
- Build it with your cross-compiled Qt
- Fails to run on BBB complaining about QWS
All of three cases, i use same KIT (included device, compiler, qmake,...)
-
I must say that it defies logic...
-
sorry, i don't understand
all three cases is different.
the third case i don't use class which automatically create by Qt creator, i created manually -
That's why it defies logic. I don't see why a simple derived class would trigger that error.
Can you run ldd on all three applications on your target and post the output ?
-
output of case1 (application run ok):
libQtGui.so.4 => /usr/lib/arm-linux-gnueabihf/libQtGui.so.4 (0xb681e000)
libQtCore.so.4 => /usr/lib/arm-linux-gnueabihf/libQtCore.so.4 (0xb6616000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb656b000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6547000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6462000)
libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb6436000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb641a000)
libaudio.so.2 => /usr/lib/arm-linux-gnueabihf/libaudio.so.2 (0xb6402000)
libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb6343000)
libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0xb6322000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6309000)
libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb62a4000)
libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb6265000)
libSM.so.6 => /usr/lib/arm-linux-gnueabihf/libSM.so.6 (0xb6258000)
libICE.so.6 => /usr/lib/arm-linux-gnueabihf/libICE.so.6 (0xb6240000)
libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0xb6232000)
libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb621f000)
libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb6136000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb60cb000)
/lib/ld-linux-armhf.so.3 (0xb6f02000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb60c0000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb60b2000)
libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0xb6090000)
libXt.so.6 => /usr/lib/arm-linux-gnueabihf/libXt.so.6 (0xb604e000)
libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0xb6044000)
libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb600b000)
libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb6001000)
libffi.so.5 => /usr/lib/arm-linux-gnueabihf/libffi.so.5 (0xb5fef000)
libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0xb5fe3000)
libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb5fc8000)
libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0xb5fbd000)
output of case2 ( keep the MainWindow class):
libQtGui.so.4 => /usr/lib/arm-linux-gnueabihf/libQtGui.so.4 (0xb68fd000)
libQtCore.so.4 => /usr/lib/arm-linux-gnueabihf/libQtCore.so.4 (0xb66f5000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb664a000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6626000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6541000)
libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb6515000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb64f9000)
libaudio.so.2 => /usr/lib/arm-linux-gnueabihf/libaudio.so.2 (0xb64e1000)
libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb6422000)
libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0xb6401000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb63e8000)
libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb6383000)
libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb6344000)
libSM.so.6 => /usr/lib/arm-linux-gnueabihf/libSM.so.6 (0xb6337000)
libICE.so.6 => /usr/lib/arm-linux-gnueabihf/libICE.so.6 (0xb631f000)
libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0xb6311000)
libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb62fe000)
libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb6215000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb61aa000)
/lib/ld-linux-armhf.so.3 (0xb6fe1000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb619f000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6191000)
libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0xb616f000)
libXt.so.6 => /usr/lib/arm-linux-gnueabihf/libXt.so.6 (0xb612d000)
libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0xb6123000)
libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb60ea000)
libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb60e0000)
libffi.so.5 => /usr/lib/arm-linux-gnueabihf/libffi.so.5 (0xb60ce000)
libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0xb60c2000)
libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb60a7000)
libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0xb609c000)
output of case3 (use abc class):
libQtGui.so.4 => /usr/lib/arm-linux-gnueabihf/libQtGui.so.4 (0xb681c000)
libQtCore.so.4 => /usr/lib/arm-linux-gnueabihf/libQtCore.so.4 (0xb6614000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6569000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6545000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6460000)
libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb6434000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6418000)
libaudio.so.2 => /usr/lib/arm-linux-gnueabihf/libaudio.so.2 (0xb6400000)
libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb6341000)
libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0xb6320000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6307000)
libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb62a2000)
libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb6263000)
libSM.so.6 => /usr/lib/arm-linux-gnueabihf/libSM.so.6 (0xb6256000)
libICE.so.6 => /usr/lib/arm-linux-gnueabihf/libICE.so.6 (0xb623e000)
libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0xb6230000)
libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb621d000)
libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb6134000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb60c9000)
/lib/ld-linux-armhf.so.3 (0xb6f00000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb60be000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb60b0000)
libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0xb608e000)
libXt.so.6 => /usr/lib/arm-linux-gnueabihf/libXt.so.6 (0xb604c000)
libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0xb6042000)
libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb6009000)
libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb5fff000)
libffi.so.5 => /usr/lib/arm-linux-gnueabihf/libffi.so.5 (0xb5fed000)
libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0xb5fe1000)
libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb5fc6000)
libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0xb5fbb000) -
So there's indeed something funky going on. On your target you have your application loading the "desktop Qt 4" while you are cross-compiling on your machine.
So again, if you are using your application with QWS on the target, install your cross-compiled Qt on it. If not, cross-compile Qt 4 again but not for embedded.
-
output ldd of case 1 and case 2 is same.
case 1 is ok. but, case 2 is not ok. why?