[PPL-devel] Printing problem

Roberto Bagnara bagnara at cs.unipr.it
Fri Jul 15 08:58:41 CEST 2016


On 14/07/2016 23:57, Jeff Summars wrote:
> My name is Jeff Summers, and I'm a PhD student. I'm an experienced user of the Sage interface to PPL, but I am new to using it directly (and new to C++). I am aiming low, and trying to print a single constraint as described in the C++ manual for users (page 218). I simplified the code to:
> 
> 
> #include <iostream>
> #include <ppl.hh>
> using namespace std;
> using namespace Parma_Polyhedra_Library;
> 
> int main()
> {
>   Variable x(0);
>   Variable y(1);
>   Constraint c1(x - 5*y<= 4);
> 
>   cout << "Constraint c1: " << c1 << endl;
>   return 0l
> }
> 
> 
> which I attempt to compile using: g++ -g test.cpp -lppl -lgmpxx -lgmp
> 
> I get the following:
> 
> test.cpp: In function ‘int main()’:
> test.cpp:12:29: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘Parma_Polyhedra_Library::Constraint’)
>    cout << "Constraint c1: " << c1 << endl;
> [...]
> 
> The compiler does not like that I am trying to print c1. I assume that I have done something foolish, and I appreciate any help. Thanks!

Hello Jeff.

There is a typo in your example ("return 0l" instead of "return 0;").
Apart from that, the solution to your problem is described at pages 88-89
of the manual:

  http://bugseng.com/products/ppl/documentation//ppl-user-1.2.pdf

Kind regards,

   Roberto

-- 
     Prof. Roberto Bagnara

Applied Formal Methods Laboratory - University of Parma, Italy
mailto:bagnara at cs.unipr.it
                              BUGSENG srl - http://bugseng.com
                              mailto:roberto.bagnara at bugseng.com



More information about the PPL-devel mailing list