ProLinga-Calc Project |
---|
A very basic example program using ProLinga-Calc looks like this:
#include <stdio.h> #include <prolinga/Calc.hpp> int main() { char *expression = "2+5"; char *result; PlCalc calc; printf("Expression is %s\n", expression); result = calc.getCalc(expression); printf("Result is %s\n", result); return 0; }
This assigns 2 + 5
to
expression
, calls the function
getCalc
of class PlCalc for the calculation of
2 + 5
and assigns the
outcome to result
.
To compile the program, use the following command:
g++ calc_test.cpp -o calc_test `pkg-config --cflags --libs prolinga-calc`
You may need to set the environment variable PKG_CONFIG_PATH to
point to the directory where prolinga-calc.pc is located. By default this is
directory /usr/local/lib/pkgconfig
on Linux for
example.
You can also use a more traditional command as:
g++ calc_test.cpp -o calc_test -I/usr/local/include/ -L/usr/local/lib -lprolingacalc
<< ProLinga-Calc Project | Download ProLinga-Calc >> |