qtserialport ...错误:未在此范围内声明'Q_NULLPTR'

时间:2016-07-25 10:20:07

标签: qt c++11 serial-port g++ ubuntu-16.04

尝试按照硬件提供商建议的这些序列安装qt creator ......

sudo apt-get install libudev-dev
git clone git://code.qt.io/qt/qtserialport.git && cd qtserialport
git checkout origin/old/5.2
cd .. 
mkdir qtserialport-build && cd qtserialport-build 
qmake ../qtserialport/qtserialport.pro 
make && sudo make install

cd ../qtserialport/ && git checkout origin/5.3
cd ../qtserialport-build/
make

但是在最后一次制作中遇到错误:

In file included from /home/polar/soft/lib/qt/qtserialport/src/serialport/qserialport.cpp:45:0:
/home/polar/soft/lib/qt/qtserialport/src/serialport/qserialport.h:190:44: 

error: ‘Q_NULLPTR’ was not declared in this scope
     explicit QSerialPort(QObject *parent = Q_NULLPTR);
                                            ^

在stackoverflow上,有人建议将QMAKE_CXXFLAGS += -std=c++0x,其他CONFIG += c++11添加到.pro文件。这些对我不起作用....实际上至少有两个.pro文件......我需要修改哪一个?

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

Q_NULLPTR在头文件qserialportglobal.h中声明为int,所以你只需要在qserialport.h文件中执行#include