linux 系统安装muParser

muParser主页 muParser是用来解析数学表达式的一个库,平时用的上,特别是在做计算的时候。安装步骤如下:(安装环境:ubuntu15.10)

  1. 下载源码包到本地。
  2. 解压。
  3. 切换到解压目录下。
  4. 安装:
    • ./configure
    • make
    • sudo make install
  5. 使用:
    • #include ‘muParser.h’
    • 可以参照官方主页的 example~

到上一步后一切正常,按理说应该已经安装好了,但是使用的时候出了问题。编译官网给出的例子会出现:undefined reference to `mu::Parser::Parser()’ 等一大推报错。检查了一下include文件都正常,库文件也在该在的位置,但是就是不能够正常编译,折腾了好久,还是在官网上找到了解决办法: Sometimes including the library sources directly into an application is the easiest possibility to avoid linker conflicts originating from different versions of the runtime libraries used by the parser and your project. In order to use the parser simply include the following files into your project: 有时候直接将源码文件包含在你的项目中就可以避免因为库文件版本不同导致的链接错误……所以在编译的时候把以下源码文件添加进来,为了使用方便可以把这几个文件保存在系统的某个位置留待以后使用。这样编译的时候一切正常! muParser.cpp muParserBase.cpp muParserBytecode.cpp muParserCallback.cpp muParserError.cpp muParserTokenReader.cpp : g++ example.cpp $youpath/* 这样做后不会报错,实际上这已经不需要链接 .so文件了。


如果你对本文有任何疑问或建议,欢迎联系我。本博客所有文章除特别声明外,均为原创文章,未经授权请勿转载!

ubuntu 安装字体文件脚本 上一篇
vim-latex 学习笔记 下一篇

 目录