Menu

Why my GTK+ program can't run by double click when I used the PLplot in my program?

2016-09-23
2016-09-23
  • LI Chang-Sheng

    LI Chang-Sheng - 2016-09-23

    Hi all,
    In my the operating system ubuntu14.04, a classical GTK+ program can be run by double click. When the PLplot was used in the program, it could not be run by double click and should run in a terminal. The follow example was given by PLplot. https://sourceforge.net/p/plplot/plplot/ci/master/tree/examples/c/extXdrawable_demo.c
    If we cut out the follow Plplot code segment in extXdrawable_demo.c

    /*
        plsdev( "xcairo" );
        plsetopt( "drvopt", "external_drawable" );
        plinit();
      #if TO_PIXMAP == 1
        // Here we set up to draw to a pixmap
        xinfo.display  = GDK_PIXMAP_XDISPLAY( a->plotwindow_pixmap );
        xinfo.drawable = GDK_PIXMAP_XID( a->plotwindow_pixmap );
      #else
        // Alternatively, we can do direct to a visible X Window
        xinfo.display  = GDK_WINDOW_XDISPLAY( a->plotwindow->window );
        xinfo.drawable = GDK_WINDOW_XID( a->plotwindow->window );
      #endif
        pl_cmd( PLESC_DEVINIT, &xinfo );
        plenv( 0, 5, 0, 5, 0, 0 );
        plline( 3, x, y );
        plend();
    */
    

    and compiled the code by

    gcc extXdrawable_demo.c -o extXdrawable_demo `pkg-config --cflags --libs plplot gtk+-2.0`
    

    A executable file named extXdrawable_demo would be generated. It can be run by double click and a window would show.

    If I didn't cut out the above-mentioned Plplot code segment and compiled the code by

    gcc extXdrawable_demo.c -o extXdrawable_demo `pkg-config --cflags --libs plplot gtk+-2.0`
    

    The executable file extXdrawable_demo would still be generated. But It cannot be run by double click.
    You must run it in a terminal by

    ./extXdrawable_demo
    

    I don't konw what on earth do PLplot do for the program? Can some one answer my question and give a method to make the extXdrawable_demo run by double click as a classical GTK+ program.


    Best regards,
    LI Chang-Sheng
    School of Earth Sciences and Engineering
    Nanjing University
    163 XIANLIN Road, Nanjing
    Jiangsu Province 210023
    P.R. of China
    E-mail: sheng0619@163.com;

     
  • LI Chang-Sheng

    LI Chang-Sheng - 2016-09-23

    Hi all,
    I find the reason.
    In the past , I always set the LD_LIBRARY_PATH in ~/.bashrc.
    export LD_LIBRARY_PATH=~/desktop/support_lib/plplot-5.11.0-install/lib
    This file just runs together with a new terminal. So If I don't run the terminal, the program would not find the PLplot lib.
    Now I set LD_LIBRARY_PATH in /etc/environment. I need not open a terminal for the program, and example1 can be opened from the file browser by double-click.

    Best regards,
    LI Chang-Sheng
    School of Earth Sciences and Engineering
    Nanjing University
    163 XIANLIN Road, Nanjing
    Jiangsu Province 210023
    P.R. of China
    E-mail: sheng0619@163.com;

     

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.