Im trying to get gnuplot up running for C++ environment in XCode.
Im using following tutorial to archieve my result:
http://www.calozgroup.org/Shulabh/MediaWikiS/index.php5?title=Gnuplot_in_C%2B%2B_using_XCode
-
I have created the
libgnuplot.aand imported this along with thegnuplot_i.hinto my project. -
Copied
/opt/local/bin/gnuplotinto/usr/local/bin -
I have created the
~/MacOSX/environment.plistfile with following content:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DT$ <plist version="1.0"> <dict> <key>GNUTERM</key> <string>aqua</string> <key>PATH</key> <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string> </dict> </plist>
The error occurs when compiling following sample code:
char myStr[] = "text";
char myEqu[] = "sin(x)";
gnuplot_ctrl *h;
h = gnuplot_init();
gnuplot_plot_equation(h, myEqu, myStr);
gnuplot_close(h);
Error:
cannot find gnuplot in your PATH(lldb)
Furthermore i was getting following compiler warnings:
Conversion from string literal to 'char *' is deprecated
gnuplot_setstyle(handle, "lines");
I tried to modify these to:
char line_string[] = "lines";
gnuplot_setstyle(handle, line_string);
I reinstalled gnuplot and it suddenly worked.