Dear all,
when trying to save the output of the VISUAL-Method in C++, I constantly get errors ("input value is not an Object"). Is VISUAL not returning an perl::Object? A short piece of code is attached, where you can see the error.
Best wishes,
Sebas
Part 1: visualtest.cc
#include <polymake/Main.h>
#include <polymake/Matrix.h>
#include <polymake/SparseMatrix.h>
#include <polymake/Rational.h>
using namespace polymake;
int main(int argc, const char* argv[]) {
try {
const int dim = 4;
Main pm;
pm.set_application("polytope");
perl::Object* p = new perl::Object("Polytope<Rational>");
p->take("VERTICES") << 3*unit_matrix<Rational>(dim);
perl::Object q = p->CallPolymakeMethod("VISUAL");
} catch (const std::exception& ex) {
std::cerr << "ERROR: " << ex.what() << endl; return 1;
}
return 0;
}
Part2: Makefile
PM_INC := $(shell polymake-config --includes)
PM_CFLAGS := -fPIC -DPOLYMAKE_DEBUG=0
PM_LIBS := $(shell polymake-config --libs)
PM_LDFLAGS := $(shell polymake-config --ldflags)
CFLAGS += -march=native
LDFLAGS += -Wl,-rpath,-lpolymake -lxml2
all: visualtest
.o: visualtest.cc
g++ -o visualtest.o -c -I. ${PM_INC} ${PM_CFLAGS} ${CFLAGS} visualtest.cc
visualtest: visualtest.o
g++ -o visualtest visualtest.o ${PM_LDFLAGS} ${PM_LIBS} ${LDFLAGS}
Sorry for copying the files. It says such attachments are not allowed .