Menu

Call gnu plot in MS Studio

Help
2019-09-10
2019-09-18
  • veerendra singh

    veerendra singh - 2019-09-10

    Dear Sir

    I downloaded and installed gp527-win64-mingw.exe.

    But when I call this in a C programme the following message pop up,

    This version of .......\Visual Studio 2015\Projects\Code1\gnuplot.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

    Can you suggest any solution ?

     
  • Tatsuro MATSUOKA

    How do you call gnuplot?
    The below is an example using "pipe" ;

    #include <stdio.h>
    
     int main(void){
     FILE *gp;
    
      gp = popen("gnuplot -persist","w");
      fprintf(gp, "plot sin(x)\n");
    
        pclose(gp);
    
       return 0;
      }
    
     

    Last edit: Tatsuro MATSUOKA 2019-09-11
  • Tatsuro MATSUOKA

    Did you set path to where gnuplot.exe is placed?

     
  • Tatsuro MATSUOKA

    Sorry.
    VC does not have popen nor pclose but has _popen and _pclose.
    I do not have GUI version VC and I tried the below command line version VC 2019.

    #include <stdio.h>
    
     int main(void){
     FILE *gp;
    
      gp = _popen("gnuplot -persist","w");
      fprintf(gp, "plot sin(x)\n");
    
       _pclose(gp);
    
      return 0;
      }
    
    D:\usr\Tatsu\program\gnuplot\test27>cl test1.cpp
    Microsoft(R) C/C++ Optimizing Compiler Version 19.22.27905 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    test1.cpp
    Microsoft (R) Incremental Linker Version 14.22.27905.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    /out:test1.exe
    test1.obj
    
    D:\usr\Tatsu\program\gnuplot\test27>.\test1 
    
     

    Last edit: Tatsuro MATSUOKA 2019-09-13
  • Tatsuro MATSUOKA

    I could not understand what you want do.

    Do you want save plot date to text file?
    If so, please consult "set table" in the help.

    Or
    do you want plot a data file "foo.txt" like

    # foo.txt
    0 0
    1 1
    2 4
    3 9
    4 16
    5 25
    
    #include <stdio.h>
    #include <stdlib.h>
    
     int main(void){
     system("start wgnuplot --persist -e \"plot 'foo.txt'\" ");
    
       return 0;
      }
    
     

    Last edit: Tatsuro MATSUOKA 2019-09-18

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.