[ROOT] Newbie question.

From: Andrew Steiner (stein@physics.umn.edu)
Date: Tue Sep 03 2002 - 17:12:46 MEST


Hello!
	The following code produces a blank Post-Script file (or actually,
it produces a file which creates the plot and then erases it). Could
someone let me know what I am doing wrong? My makefile is reproduced
below, as well as the line which I used to configure root before
installing it into my user directory. I am using RH 6.1 with egcs-2.91.66.
	I thank the creators for what seems so far to be a fine product.

Thanks,
Andrew Steiner

----------------------------Code---------------------------------------
#include <stdio.h>
#include <TCanvas.h>
#include <Rtypes.h>
#include <TGraph.h>
#include <TLatex.h>

int main(void) {

  float *xv,*yv;
  xv=new float[2];
  yv=new float[2];
  int nlines = 2;

  TCanvas *c1;
  TGraph *gr;

  xv[0]=1;
  yv[0]=2;
  xv[1]=2;
  yv[1]=4;

  c1 = new TCanvas("c1","",0,0,500,500);

  c1->SetFillColor(0);

  gr = new TGraph(nlines,xv,yv);

  gr->SetFillColor(0);
  gr->SetLineColor(1);
  gr->SetLineWidth(1);
  gr->SetMarkerColor(1);

  // Make big dots
  gr->SetMarkerStyle(7);

  // Remove the title
  gr->SetTitle("");

  // Draw axis and points
  gr->Draw("AP");

  c1->Print("plot.eps");

  return 0;
}

---------------------Makefile-----------------------------------
ROOTLIBS = -L/home/asteiner/root/lib -lCore -lCint -lHist -lGraf \
	-lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix \
	-lPhysics -lGui -lm -ldl -lpthread -rdynamic

test.o: test.cpp
	g++ -ggdb -c test.cpp -I/home/asteiner/root/include

test: test.o
	g++ -lm -ggdb -o test test.o $(ROOTLIBS)

------------Configuration------------------------------------------
configure linux --prefix=/home/asteiner/root \
--libdir=/home/asteiner/root/lib --incdir=/home/asteiner/root/include \
--mandir=/home/asteiner/root/man/man1 --etcdir=/home/asteiner/root/etc \
--datadir=/home/asteiner/root



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET