What should I add to this to see ROOT graph running .exe?

Hello there.
I can run the code below under ROOT shell and I could see the picture with graph.
But when I compile this file with external compiler all works except the picture drawing.
What should I add to this code to see the picture with graph when I compile this with external VC++8.0 (WIN32 console project, Windows XP) compiler and run .exe file?
Is it simple like with ROOT shell?

The following libraries were included in compilation
c:\root\lib\libCore.lib c:\root\lib\libRIO.lib c:\root\lib\libHist.lib c:\root\lib\libTree.lib c:\root\lib\libGraf.lib c:\root\lib\libGpad.lib

#include <stdio.h>
#include
#include “c:\root\include\RTypes.h”
#include “c:\root\include\TComplex.h”
#include “c:\root\include\TFile.h”
#include “c:\root\include\TTree.h”
#include “c:\root\include\TGraphErrors.h”
#include “c:\root\include\TH1F.h”
#include “c:\root\include\TH2D.h”
#include “c:\root\include\TMath.h”
#include “c:\root\include\TCanvas.h”
#include “c:\root\include\TFrame.h”
#include “c:\root\include\TBrowser.h”

using namespace std;

typedef char Str29[29];
typedef char Str5[5];
typedef char Str4[4];
typedef char *Strin;

const Double_t pi=4.0*(TMath::ATan(1.0));
const Double_t Aprot=0.938272029;
const Double_t Apion=0.13957018;
const Double_t Akaon=0.493677;
const Double_t gn=0.389379323;

const Int_t N_max=1000;
Double_t sqrs[N_max], s[N_max], ds[N_max], trm[N_max], sig[N_max], dsigstat[N_max], dsigsyst[N_max], dsigtot[N_max], Elab[N_max], dsigsystper[N_max];
Int_t ntrack, ObsKey, ProcKey, DataSetKey=999, Count=0, Key1[N_max], Key2[N_max];
Str29 Ref[N_max];
Str5 slElab[N_max], sldsigsystper[N_max];
Str4 percsymb[N_max];
Strin DataL[N_max];
FILE *F1, *F2, *F3;
TFile *F4;

int main()
{
Int_t i=0, j=0;

F1=fopen(“c:\SBegun\Work\Redjeons\DATA\alldata_v0_1.dat”, “r”);
F2=fopen(“c:\SBegun\from_all_v0_1.dat”, “w+”);
F3=fopen(“c:\SBegun\result.dat”, “w+”);
F4= new TFile(“c:\SBegun\results.root”,“RECREATE”,“Results of fitting”);

TTree *Mt3 = new TTree(“Mt3”,“RESULTS OF FITTING”);
Mt3->Branch(“ntrack”,&ntrack,“ntrack/I”);
Mt3->Branch(“s”,&s,“s[ntrack]/D”);
Mt3->Branch(“sig”&,sig,“sig[ntrack]/D”);
Mt3->Branch(“dsigtot”,&dsigtot,“dsigtot[ntrack]/D”);

TH2D *SigS= new TH2D(“SigS”,“Cross Section”,40,0,30,40,0,200);

std::cout << "Input ‘observable key’:\ ";
std::cin >> ObsKey;

std::cout << “\n” << "Input process code:\ ";
std::cin >> ProcKey;

std::cout << “\n” << "Input the data set key two ciphers:\ ";
std::cin >> DataSetKey;

… reading from file

ntrack=Count;

TCanvas *c1 = new TCanvas(“c1”,“gerrors2”,200,10,700,500);
c1->SetFillColor(42);
c1->SetGrid();
TH1F *hr = c1->DrawFrame(0.0,0.0,30.0,400.0);
hr->SetXTitle(“X title”);
hr->SetYTitle(“Y title”);
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
TGraphErrors *gr2 = new TGraphErrors(Count,s,sig,0,dsigtot);
gr2->SetMarkerColor(kRed);
gr2->SetMarkerStyle(20);
gr2->Draw(“LP”);

Mt3->Fill();
Mt3->Print();
F4->Write();

fclose(F1);
fclose(F2);
fclose(F3);
F4->Close();
return 0;
}

Cheers,
Sergij Begun

You must create a TApplication or TRint object (if you want to have the CINT prompt) like shown below:

Rene

#include "TApplication.h"
#include "TCanvas.h"
#include "TH1.h"


int main(int argc, char **argv)
{
   // Create an interactive ROOT application
   TApplication *theApp = new TApplication("myapp", &argc, argv);

   TCanvas *c1 = new TCanvas("c1","gerrors2",200,10,700,500);
   c1->SetFillColor(42);
   c1->SetGrid();
   TH1F *hr = c1->DrawFrame(0.0,0.0,30.0,400.0);
   hr->SetXTitle("X title");
   hr->SetYTitle("Y title");

   // and enter the event loop...
   theApp->Run();

   delete theApp;

   return 0;
}

Thank you for help.

All works now.

Cheers,
Sergij Begun.