Unsolved [Error] undefined symbol: _ZN7QWidget8qwsEventEP8QWSEvent
-
i don't see QWS classe in my code
-
Are you trying to run a Qt 4 build of your application against Qt 5 on your device ?
-
@SGaist said:
Are you trying to run a Qt 4 build of your application against Qt 5 on your device ?
i still don't try it.
but i just have ran application with option -qws.
but it don't discard this error. -
What version of Qt do you have on your target ? What linux distribution are you running on it ?
-
my target is using qt4
my linux distribution is ubuntu lts 14.04 -
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...