QtCreator使用Boost

在 .pro 文件中, 添加:

  1. windows:
  2. INCLUDEPATH += include所在路径
  3. linux:
  4. INCLUDEPATH += /usr/local/include/boost

然后:
在需要引用Boost库的源文件中将Boost头文件包含进来就可以引用了。

示例代码:

  1. #include "dialog.h"
  2. #include <boost/timer.hpp>
  3. #include <QApplication>
  4. int main(int argc, char *argv[])
  5. {
  6. boost::timer tmr;
  7. QApplication a(argc, argv);
  8. Dialog w;
  9. w.show();
  10. qDebug() << tmr.elapsed() << "S" << endl;
  11. return a.exec();
  12. }