Mac

Dear all
ROOT I use a Mac OX 10.4, I have tried to create a source using libraries, for example:

#include “stdio.h”
#include “TH1F.h”
#include "TCanvas.h"
int main()
{

TCanvas *myc = new TCanvas(“myc”, “Prova”, 800, 600);
myc->SetFillColor(45);
TPad *c1_1 = new TPad(“c1_1”, “c1_1”,0.01,0.51,0.49,0.99);
TPad *c1_2 = new TPad(“c1_2”, “c1_2”,0.51,0.51,0.99,0.99);
TPad *c1_3 = new TPad(“c1_3”, “c1_3”,0.01,0.01,0.49,0.49);
TPad *c1_4 = new TPad(“c1_4”, “c1_4”,0.51,0.01,0.99,0.49);
c1_1->Draw();
c1_2->Draw();
c1_3->Draw();
c1_4->Draw();
}

Using the appropriate compiler options new a.out but when the launch does not create the canvas.

Thanks

Hi,

rename your function to e.g. prova() (instead of main()), save your source into prova.C, start ROOT, and simply do:
root [0] .x prova.C+
No need to compile or link anything (or fix the issue with missing graphics) - ROOT will take care of it.

Cheers, Axel.

Hi

Thank for your answer, I want to use a source not a macro root.
Can be done?

Thank all

Hi,

prova.C is a source file. “Macro” is just a misleading word - prova.C+ will invoke your compiler and linker and generate a shared library. There is NO difference in performance nor code validity checks to what you are trying to do.

If you really do need a stand-alone binary: could you tell us your use case? You will need a TApplication object and you will need to keep your program running, or all windows will vanish before they show up (see TVirtualPad::WaitPrimitive()). But again: don’t do it. Use the “+”.

Axel.

Thank you for answer

Andrea