• cicche

    cicche - 2005-05-12

    what have I to write in my makefile in libs and cflags
    for compiling my program with gcc?

    • Andrea Tagliasacchi

      i used g++ but i think is the same...
      With g++ you have to include the header and for it you use the -I option
      Also, an inclusion of the library and its path is necessary. In order to do so you have to use respectively the -l and -L options.

      For example suppose to have the varius elements in these positions:

      then my command is something like:
      g++ -I/usr/include/plplot/ -L/usr/lib -lplplotcxxd helloworld.cpp

      I tried it now and it works flawlessy. As a referece, here it is a VERY easy helloworld application I wrote. I think the examples they put are too complicated.. mine is a reduction of ex4.

      ###### BEGIN CODE ########
      #include "plstream.h"
      #include <iostream>
      #include <cmath>

      #ifdef USE_NAMESPACE
          using namespace std;

      int main( int argc, char ** argv ) {
        plstream *pls = new plstream();

        // Initialize PLplot.
        plsdev( "gcw" ); /* USE GNOME WINDOW BY DEFAULT */
        plscolbg (255,255,255); /* SET THE GRAPH BACKGROUND */
        pls->init();  /* INITIALIZE THE WIDGET */
        pls->font(2); /* CHOOSE THE FONT */

        pls->adv(0); /* advance to next page */

        // NUMB DATA
        PLFLT *freql = new PLFLT[101];
        PLFLT *ampl  = new PLFLT[101];
        for (int i = 0; i <= 100; i++) {
          freql[i] = i;
          ampl[i]  = i + 3*sin( 2*M_PI*10*i/100 );

        //pls->vpor(0.15, 0.85, 0.1, 0.9);  // set
        pls->wind( 0, 100, 0, 100);         // set axis x-range, y-range

        // Try different axis and labelling styles.

        plrgb(0,0,0); pls->box("bnstg", 0.0, 0, "bnstvg", 0.0, 0);

        // Plot ampl vs freq.
        plcol0(1); c_plpoin( 101, freql, ampl, 94 ); /* plot line junction points */
        //plrgb(1,0,1); pls->line( 101, freql, ampl, 68 ); /* plot line junction points */

        // Put labels on.
        plrgb(0,0,0); pls->mtex("b", 3.2, 0.5, 0.5, "Frequency");
        plrgb(0,0,0); pls->mtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)");

        delete[] freql;
        delete[] ampl;
        delete pls;


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks