2014-05-18 3 views
-4

이 사이트에서 아래의 코드를 구현하기 위해 노력하고있어 : 코드 의 gnuplot - 경로 오류

https://sites.google.com/site/bettereaclone/introduction/gnuplot/c-example-gnuplot-1

:

#include <iostream> 
#include "gnuplot_i.hpp" 
#include <windows.h> 
#include <conio.h> 
using std::cout; 
using std::endl; 
int main(int argc, char* argv[]) 
{ 
    try 
    { 
     Gnuplot g1("lines"); 
     cout << "*** plotting slopes" << endl; 
     g1.set_title("Slopes\\nNew Line"); 

     cout << "y = x" << endl; 
     g1.plot_slope(1.0,0.0,"y=x"); 

     cout << "y = 2*x" << endl; 
     g1.plot_slope(2.0,0.0,"y=2x"); 

     cout << "y = -x" << endl; 
     g1.plot_slope(-1.0,0.0,"y=-x"); 
     g1.unset_title(); 
    } 
    catch (GnuplotException ge) 
    { 
     cout << ge.what() << endl; 
    } 
    return 0; 
} 

나는의 gnuplot을 설치 (http://www.gnuplot.info/download.html)

gnuplot_i.hpp 파일 (https://code.google.com/p/gnuplot-cpp/source/browse/trunk/gnuplot_i.hpp)

012 내가 왜 아무 생각도 없어

'C:/Program' is not recognized as an internal or external command, operable program or batch file.

:

enter image description here

오류 :이 코드를 실행하면 3,516,

, 나는이 문제를 얻는다. 감사!!

+2

당신은 코드 조각에 리디렉션. 문제를 재현 할 수있는 코드 스 니펫으로 분리하는 것이 좋습니다. SO는 코드 리뷰 포럼이 아닙니다. – 101010

+0

내가 이것을 고치려고 노력하게해라. .. 나는 그것을 게시하는 방법을 정말로 모르고있다.. 그러나 나는 고칠 것이다 –

+0

사실이다, 무엇인가이다! 이 게시물을 닫을 수있는 방법이 있습니까? 나는이 질문을 표시했다. –

답변

1

gnuplot의 경로가 잘못된 형식이거나 인용 부호가 아니거나 단순히 올바르게 읽지 않은 것 같습니다.

이 라인을 주석을 해제하고 시스템에 디렉토리의 gnuplot 가리 키도록 수정하여 경로를 강제로 시도해보십시오

// Gnuplot::set_GNUPlotPath("C:/program files/gnuplot/bin/"); 
+0

'try'하기 전에 시도했지만 아무것도 변경되지 않았습니다. ( –

+0

또한 경로를 따옴표로 묶으려고 시도 할 수도 있습니다 :'Gnuplot :: set_GNUPlotPath ("\"C :/program files/gnuplot/bin/\ ""); ' – Telvas

+0

같은 오류 ... _C :/Program Files_를 _C : \ Proga ~ 1_로 대체하려고 시도했지만 작동하지 않았습니다. –