by Forrest Sheng Bao http://fsbao.net
There are many open source projects called adsolver. Here I mean this one http://www.cs.ttu.edu/~mellarko/adsolver.html , made by an alumni of my lab, combining Answer Set Programming and Constraint Logic Programming. If you download her solver, you will find many problems on compiling it on *modern* Linux and gcc. So, here is the solution.
Following procedures are tested on Ubuntu Linux 9.04 with gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) .
First batch of errors:
For the 2nd error at predicate.h:140, change line 140 from
Second batch of errors:
Now run
Now you are should have no problems to finish compiling adsolver.
There are many open source projects called adsolver. Here I mean this one http://www.cs.ttu.edu/~mellarko/adsolver.html , made by an alumni of my lab, combining Answer Set Programming and Constraint Logic Programming. If you download her solver, you will find many problems on compiling it on *modern* Linux and gcc. So, here is the solution.
Following procedures are tested on Ubuntu Linux 9.04 with gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) .
First batch of errors:
$ make g++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c array.cc In file included from literal.h:33, from predicate.h:30, from array.cc:33: instance.h:161: error: ‘RBTreeIterator’ does not name a type instance.h:162: error: ‘HashSetIterator’ does not name a type In file included from array.cc:33: predicate.h:140: error: extra qualification ‘Predicate::’ on member ‘getMixedInstance’ predicate.h:187: error: ISO C++ forbids declaration of ‘InstanceIterator’ with no type predicate.h:187: error: expected ‘;’ before ‘*’ tokenFor the 1st error at instance.h:161, add
class HashSetIterator; class RBTreeIterator;at the end of the block of
#include
statements in instance.h
.For the 2nd error at predicate.h:140, change line 140 from
long Predicate::getMixedInstance(long i);to
long getMixedInstance(long i);since you don't need namespace when declaring a function inside a class .
Second batch of errors:
Now run
make
again and *hopefully* you will see this error:sm_smodels.cc:21:22: error: iostream.h: No such file or directory sm_smodels.cc: In member function ‘void SM_Rule::print()’: sm_smodels.cc:806: error: ‘cout’ was not declared in this scope sm_smodels.cc:825: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void SM_Rule::print_internal()’: sm_smodels.cc:831: error: ‘cout’ was not declared in this scope sm_smodels.cc:845: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Dcl::print()’: sm_smodels.cc:1114: error: ‘cout’ was not declared in this scope sm_smodels.cc:1114: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Program::print()’: sm_smodels.cc:1419: error: ‘cout’ was not declared in this scope sm_smodels.cc:1438: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Program::print_internal(long int)’: sm_smodels.cc:1458: error: ‘cout’ was not declared in this scope sm_smodels.cc:1458: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Smodels::print()’: sm_smodels.cc:1671: error: ‘cout’ was not declared in this scope sm_smodels.cc:1675: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Smodels::printAnswer()’: sm_smodels.cc:1694: error: ‘cout’ was not declared in this scope sm_smodels.cc:1698: error: ‘endl’ was not declared in this scope sm_smodels.cc: In member function ‘void Tree::check_consistency(Tree::Node*)’: sm_smodels.cc:1882: error: ‘cerr’ was not declared in this scope sm_smodels.cc:1883: error: ‘endl’ was not declared in this scope sm_smodels.cc:1888: error: ‘cerr’ was not declared in this scope sm_smodels.cc:1889: error: ‘endl’ was not declared in this scope make: *** [sm_smodels.o] Error 1The reason is in C++, including library does not need .h suffix. So, open
sm_smodels.cc
and remove the .h
suffix for iostream
library. And do not forget to insert this line using namespace std;after
#include
blocks. Now you are should have no problems to finish compiling adsolver.
No comments:
Post a Comment