Advertisement

muparser - Fast Math Parser Library

Version 2.2.5


Building on win32

The muparser library supports various win32 command-line compilers:

In order to compile muparser from makefiles, open a command prompt then move to the muparser/build directory and type:

All makefiles support the following options:
  # Set to 1 to build debug version [0,1]
  #   0 - Release
  #   1 - Debug
  DEBUG = 0

  # Set to 1 to build shared (DLL) version [0,1]
  #   0 - Static
  #   1 - DLL
  SHARED = 0

  # Set to 1 to compile samples [0,1]
  SAMPLES = 1

The muparser library is created in the 'lib' folder and the sample binaries are created in samples\example1 or samples\example2. (You may need to copy the dll into the example2 directory in order to run it.)

warning samples\example1 can be compiled *only* when building muparser as a STATIC library (SHARED=0).
samples\example2 can be compiled *only* when building muparser as a SHARED library (SHARED=1).

Building on BSD/Linux

muparser can be installed just extracting the sources somewhere and then, from a terminal, typing:

 cd [path to muparser]
 ./configure [--enable-shared=yes/no] [--enable-samples=yes/no]
             [--enable-debug=yes/no]
 make
 [sudo*] make install
* = this command must be executed with root permissions and thus you have to use 'sudo' or just 'su' to gain root access. Note that installation is not strictly required.

The "make" step will create the muparser library in 'lib' and the sample binary in samples/example1. The samples/example2 is win32-specific and thus won't be built.

Miscellaneous Unix-specific hints

If you don't like to have your muparser folder filled by temporary files created by GCC, then you can do the following:
  mkdir mybuild && cd mybuild && ../configure && make
to put all object files in the "mybuild" directory. If you want to use muparser library in your programs, you can use the pkg-config program (this works only if muparser was installed with 'make install' !). The commands: will return all useful info you need to build your programs against muparser !

Including the source code directly

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

And make sure the following files can be found in your projects include path:

muParser.h
muParserBase.h
muParserBytecode.h
muParserCallback.h
muParserDef.h
muParserError.h
muParserFixes.h
muParserStack.h
muParserToken.h
muParserTokenReader.h

The parser class and all related classes reside in the namespace mu. So make sure to either add a using

using namespace mu;
to your files or reference all classes with their complete name.
previous page      next page

You might also like: