sh:gnuplot:在gnuplot+;Xcode

sh:gnuplot:在gnuplot+;Xcode,xcode,gnuplot,Xcode,Gnuplot,有一个类似的问题,我的答案是不完全解决,所以如果我能得到一些帮助,这将是非常感谢 问题是,当我编译时,Xcode给出了前面提到的错误sh:gnuplot:command not found 我在终端中检查了哪个gnuplot,正如预期的那样,它位于/opt/local/bin/gnuplot中。也printf(“路径=%s\n”,getenv(“路径”)显示路径path=/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bi

有一个类似的问题,我的答案是不完全解决,所以如果我能得到一些帮助,这将是非常感谢

问题是,当我编译时,Xcode给出了前面提到的错误sh:gnuplot:command not found

我在终端中检查了
哪个gnuplot
,正如预期的那样,它位于
/opt/local/bin/gnuplot
中。也
printf(“路径=%s\n”,getenv(“路径”)显示路径
path=/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
我怀疑其中存在问题,但我不确定如何解决


提前谢谢

将脚本中出现的
gnuplot
替换为
/opt/local/bin/gnuplot
,将
$PATH
从等式中剔除。

防止Xcode运行的关键问题确实与
gnuplot
路径相关。根据您在mac中使用的软件包管理系统,
gnuplot
的目录可能会有所不同

在终端中键入
哪个gnuplot
将显示
gnuplot
的确切位置

macport
的情况下,
gnuplot
位于
/opt/local/bin
中,这不包括在Xcode的默认路径设置中

要检查路径,请键入

std::cout << "PATH=" << getenv("PATH") << std::endl; // #include<iostream>
printf( "PATH=%s\n", getenv("PATH") ); // #include<cstdio>
#include <iostream>

#include "gnuplot-iostream.h"

int main( ) {
    Gnuplot gp;
    gp << "plot [-10:10] sin(x),atan(x),cos(atan(x))\n";
    return 0;
}