qwt安装 linux,Mac OS X下Qwt安装

1.QWT

Qwt (http://sourceforge.jp/projects/sfnet_qwt/)is a graphics extension to the Qt GUI application framework from Trolltech AS of Norway. It provides a 2D plotting widget and more.

2.安装Qwt

a. cd /path/to/qwt

b. qmake

c. make -j 4

d. sudo make install

以上方法会将qwt安装到/usr/local/qwt-6.1.2

3.测试Qwt是否安装成功

3.1 LearnQwt

A. LearnQwt.pro

QT +=core gui

include(/usr/local/qwt-6.1.2/features/qwt.prf)

INCLUDEPATH += /usr/local/qwt-6.1.2/lib/qwt.framework/Versions/6/Headers

TARGET = LearnQwt

TEMPLATE = app

SOURCES += \

main.cxx

LIBS += -F"/usr/local/qwt-6.1.2/lib/qwt.framework"

LIBS += -framework qwt

B. main.cxx

p, li { white-space: pre-wrap; }

//std

#include 

//qwt

#include 

#include 

#include 

#include 

//qt

#include 

class SinusData : public QwtSyntheticPointData

{

public:

SinusData():

QwtSyntheticPointData(100)

{}

virtual double y(double x) const

{

return qSin(x);

}

};

int main(int argc, char **argv)

{

QApplication app(argc,argv);

QwtPlot plot;

plot.setAxisScale( QwtPlot::xBottom, 0.0, 10.0);

plot.setAxisScale( QwtPlot::yLeft, -1.0, 1.0);

QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)");

curve->setData(new SinusData());

curve->attach(&plot);

plot.show();

return app.exec();

}

C. 终端下运行LearnQwt.app

export DYLD_FRAMEWORK_PATH="/usr/local/qwt-6.1.2/lib/"

这点实在无语,和Linux平台的LD_LIBRARY_PATH起着一样的作用。否则会提示

dyld: Library not loaded: qwt.framework/Versions/6/qwt

LearnQwt.app/Contents/MacOS/LearnQwt

D. 运行结果如下:

dbc583f5995dba7a4b2065ef9e63ca18.png

4.总结。

在PRO文件中LIBS += -F "/path/to/lib" -framework(f) qwt

include("/path/to/qwt.pri")

export DYLD_FRAMEWORK_PATH="/path/to/lib"

Terminal: ./xxx.app/Contents/MacOS/xxx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值