hpdp - 2020-01-24

I'm trying to call a c++ cgi from a form-based web page. It takes an input string and produces runtime data based on the input to draw a graph. My example c++ mycode.C is

int main() {
Gnuplot gp;
std::vector<std::pair<double, double> > xy_pts_A;

xy_pts_A.push_back(std::make_pair(49, 22));
xy_pts_A.push_back(std::make_pair(50, 32));
xy_pts_A.push_back(std::make_pair(51, 52));
xy_pts_A.push_back(std::make_pair(52, 87));
xy_pts_A.push_back(std::make_pair(53, 29));

gp << "set xrange [49:99]\nset yrange [0:100]\n";   
gp << "plot '-' with lines title 'cubic'\n";
gp.send1d(xy_pts_A);
}

I compiled it to mycode.cgi, I can run this cgi from command line, it shows the graph. But when I called this cgi by submitting a form from a web-page. It didn't load the graph, it gave a general server error message. The web log error was:
"AH01215: sh: gnuplot: command not found
AH01215: pclose returned error
End of script output before headers: mycode.cgi"

test.html is

<html>
<head>
<title>upright.html</title>
</head>
<body>
<form name="myform" action="mycode.cgi">
<input type="text" name="term">
<br><input type="submit" value="Search" >
<br><input type="button" value="Reset">
</form>
</body>
</html>

Thanks a lot!