pgcd.cc and pgcd.cpp
Publié : jeu. mars 14, 2019 9:15 pm
First of all, Happy Pi Day.
The French manual has programs pgcd.cc and pgcd.cpp.
I haven't been able to get them to work. It is probably
because my system isn't set up correctly, but I was wondering
if they work for other people. (My computer has enough tools and
libraries to compile giac, but that's probably about it.)
These files are also in the giac distribution, although
the pgcd.cc is different and the pgcd.cpp in the distribution
has the line
#include "pgcd.h"
commented out, which is good since there doesn't seem to be any
file names pgcd.h.
If I compile (either version) of pgcd.cc, it compiles without problem.
(I use the line
g++ -g pgcd.cc -lgiac -lgmp
from the top of the file.) If I try to run it,
./a.out
I get an immediate
Segmentation fault (core dumped)
So there's probably something wonky about my computer.
But if I try to compile pgcd.cpp (with the pgcd.h line commented out) using
g++ -I.. -fPIC -DPIC -g -c pgcd.cpp -o pgcd.lo
from the top of the file, I get errors beginning with
> g++ -I.. -fPIC -DPIC -g -c pgcd.cpp -o pgcd.lo
pgcd.cpp:29:45: error: no matching function for call to ‘giac::una
ry_function_unary::unary_function_unary(giac::gen (*)(const giac::gen&), const string&)’
unary_function_unary __pgcd(&_pgcd,_pgcd_s);
^
(I've attached the full output at the end.)
Does this file compile for anyone else?
Jay
The French manual has programs pgcd.cc and pgcd.cpp.
I haven't been able to get them to work. It is probably
because my system isn't set up correctly, but I was wondering
if they work for other people. (My computer has enough tools and
libraries to compile giac, but that's probably about it.)
These files are also in the giac distribution, although
the pgcd.cc is different and the pgcd.cpp in the distribution
has the line
#include "pgcd.h"
commented out, which is good since there doesn't seem to be any
file names pgcd.h.
If I compile (either version) of pgcd.cc, it compiles without problem.
(I use the line
g++ -g pgcd.cc -lgiac -lgmp
from the top of the file.) If I try to run it,
./a.out
I get an immediate
Segmentation fault (core dumped)
So there's probably something wonky about my computer.
But if I try to compile pgcd.cpp (with the pgcd.h line commented out) using
g++ -I.. -fPIC -DPIC -g -c pgcd.cpp -o pgcd.lo
from the top of the file, I get errors beginning with
> g++ -I.. -fPIC -DPIC -g -c pgcd.cpp -o pgcd.lo
pgcd.cpp:29:45: error: no matching function for call to ‘giac::una
ry_function_unary::unary_function_unary(giac::gen (*)(const giac::gen&), const string&)’
unary_function_unary __pgcd(&_pgcd,_pgcd_s);
^
(I've attached the full output at the end.)
Does this file compile for anyone else?
Jay