Qt尚未移植到此操作系统
Qt has not been ported to this OS
我正试图在eclipse中使用Cross-ARM-GCC编译我的c++
项目。
我安装了GNU ARM Eclipse Plug-ins
(如上所述),通过运行sudo apt-get install libqt4-dev
安装了libqt4-dev
,并将Qt库包含在我的项目中:
/usr/include/qt4
/usr/include/qt4/Qt
/usr/include/qt4/QtCore
/usr/include/qt4/QtGui
(Project > Properties > C/C++ Build > Settings > Cross ARM C++ Compiler > Includes
)
和:
QtCore
QtGui
(Project > Properties > C/C++ Build > Settings > Cross ARM C++ Linker > Libraries
)
运行qmake
成功并创建一个Makefile
。
但我无法构建我的项目。
以下是我的代码(它在默认编译器下使用make all
而不是Cross ARM GCC
进行编译并运行良好):
main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.setGeometry(0,0,mainWindow.getButtonWidth(),mainWindow.getButtonHeight()*mainWindow.getButtonsNum());
mainWindow.show();
return app.exec();
}
主窗口.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
int getButtonWidth();
int getButtonHeight();
int getButtonsNum();
~MainWindow(){}
private:
QPushButton *button1, *button2, *button3, *button4;
const int ButtonWidth = 200;
const int ButtonHeight = 50;
const int ButtonsNum = 4;
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include <QCoreApplication>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
button1 = new QPushButton("Button1", this);
button2 = new QPushButton("Button2", this);
button3 = new QPushButton("Button3", this);
button4 = new QPushButton("Button4", this);
button1->setGeometry(QRect(QPoint(0, ButtonHeight*0), QSize(ButtonWidth, ButtonHeight)));
button2->setGeometry(QRect(QPoint(0, ButtonHeight*1), QSize(ButtonWidth, ButtonHeight)));
button3->setGeometry(QRect(QPoint(0, ButtonHeight*2), QSize(ButtonWidth, ButtonHeight)));
button4->setGeometry(QRect(QPoint(0, ButtonHeight*3), QSize(ButtonWidth, ButtonHeight)));
}
int MainWindow::getButtonWidth()
{
return ButtonWidth;
}
int MainWindow::getButtonHeight()
{
return ButtonHeight;
}
int MainWindow::getButtonsNum()
{
return ButtonsNum;
}
我在./src
:中的文件
- main.cpp
- 主窗口.cpp
- 主窗口.h
- proConfig.pro
以下是proConfig.pro:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = proConfig
TEMPLATE = app
SOURCES += main.cpp
mainwindow.cpp
HEADERS += mainwindow.h
我在eclipse中单击BuildAll,得到:
16:56:22 **** Incremental Build of configuration Release for project TestProject ****
make all
Building file: ../src/main.cpp
Invoking: Cross ARM C++ Compiler
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -O2 -g -I/usr/include/qt4 -I/usr/include/qt4/Qt -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -std=gnu++11 -fabi-version=0 -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.cpp"
In file included from /usr/include/qt4/QtCore/qnamespace.h:45:0,
from /usr/include/qt4/QtCore/qobjectdefs.h:45,
from /usr/include/qt4/QtGui/qwindowdefs.h:45,
from /usr/include/qt4/QtGui/qwidget.h:46,
from /usr/include/qt4/QtGui/qmainwindow.h:45,
from /usr/include/qt4/QtGui/QMainWindow:1,
from ../src/mainwindow.h:4,
from ../src/main.cpp:14:
/usr/include/qt4/QtCore/qglobal.h:268:4: error: #error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
# error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
^
make: *** [src/main.o] Error 1
16:56:23 Build Finished (took 469ms)
我正在尝试在eclipse中使用Cross-ARM-GCC编译我的
c++
项目。我安装了
GNU ARM Eclipse Plug-ins
(如上所述),通过运行sudo apt-get install libqt4-dev
安装了libqt4-dev
此libqt4-dev
副本适用于您的主机x86/x64 CPU。您不能使用它为您的ARM CPU进行交叉编译。
使用您的Cross-ARMGCC编译器自行构建Qt。看见https://forum.qt.io/topic/26540/how-can-i-cross-compile-qt-5-0例如
顺便说一下,Qt4已经非常老了。2015年12月以后将不再支持它。我强烈建议你改用Qt 5。
- Qt VTK交互风格的信号到小部件
- QT在错误的班级中寻找空位
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 如何在Qt窗口小部件中使用QStringView(或QStringRef)
- 如何在Qt C++中更改光标
- 如何在MS Visual Studio 2019中运行QT UI
- QT通过C++添加映射QML项目
- libssh 的函数在构建 libssh 时无法在 Qt 和 cmake 错误中找到
- 如何将点击的信号和插槽添加到qt中的自定义按钮中
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 使用Qt C++计算类似Git的SHA1哈希
- Qt focusObjectChanged example?
- 如何在cpp文件之间切换窗口?在Qt中
- Qt和C++:将QLineEdit添加到QTabWidget中
- 从数据库实时显示QT c++中的数据
- Qt Quick-如何仅从c++代码与qml属性交互
- OpenCv+mac操作系统x+qt创建者=奇怪的链接错误
- Qt尚未移植到此操作系统
- Qt平台上的操作系统级别文件I/O锁
- Qt快速如何创建一个按钮,将看起来原生的每个操作系统的应用程序中使用