[GiNaC-list] input compiling sample

Martin Ettl ettl.martin at gmx.de
Wed May 26 12:02:59 CEST 2010


Hello,

i failed to compile the sample from :http://www.ginac.de/tutorial/Input_002foutput.html#Input_002foutput on Ubuntu linux with gcc-4.4.0.


#include <iostream>
#include <string>
#include <stdexcept>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main()
{
   cout << "Enter an expression containing 'x': " << flush;
   parser reader;

   try {
       ex e = reader(cin);
       symtab table = reader.get_syms();
       symbol x = table.find("x") != table.end() ?
              ex_to<symbol>(table["x"]) : symbol("x");
       cout << "The derivative of " << e << " with respect to x is ";
       cout << e.diff(x) << "." << endl;
   } catch (exception &p) {
       cerr << p.what() << endl;
   }
}


Do you have any suggestions, i used the following command line to compile the sample:

g++ -o test test1.cpp -lginac

$ g++ -o test test1.cpp -lginac
test1.cpp: In function »int main()«:
test1.cpp:11: Error: »parser« not declared in this scope
test1.cpp:11: Error: expected »;« before »reader«
test1.cpp:14: Error: »reader« not declared in this scope
test1.cpp:15: Error: »symtab« not declared in this scope 
test1.cpp:15: Error: expected »;« before »table«
test1.cpp:16: Error: »table« not declared in this scopedefiniert


It looks like i missed some #include <ginac/parser.h> ???


Thanks in advance

Martin



-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the GiNaC-list mailing list