Hi Ricardo,
It is hard to tell what you exact problem is without some specifics.
With ROOT 3.02.07, you first example compile and run if you compiled
with something like
KCC --no_exceptions d01.C -I$ROOTSYS/include `root-config --libs`
if you are on a CDF machine or
KCC --thread_safe d01.C -I$ROOTSYS/include `root-config --libs`
if you are on a D0 machine. In both case, it is also better to
add `root-config --cflags`
Your second program has a C++ syntax error. When compiling it
you get:
bash$ KCC --no_exceptions -c d01.C -I$ROOTSYS/include
"d01.C", line 11: error: no instance of constructor
"TApplication::TApplication" matches the argument list
argument types are: (char [4], char [16])
TApplication app("App","My Root Program");
Which tells your that the TApplication class as no constructor
that take 2 strings as parameters. By looking at
$ROOTSYS/include/TApplication.h or on the web in the Reference guide,
you will see that the only constructor is:
TApplication(const char *appClassName, int *argc, char **argv,
void *options = 0, int numOptions = 0);
Hence the correct syntax is:
int main(int argc, char **argv) {
TApplication app("App", &argc, argv);
....
Cheers,
Philippe.
PS. In the next release of ROOT,
KCC `root-config --cflags` d01.C `root-config --libs`
will be sufficient in both case.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ricardo Eusebi
Sent: Friday, February 15, 2002 1:52 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] executable
How can I make an executable out of a simple root script like the following
( linux OS)
#include "TCanvas.h"
int main(){
TCanvas *can = new TCanvas("a","B",300,400);
return 0;
}
I tried everthing I saw on the web.
I also tried the following :
////////////////////////////////////////////////////////////////
//For ROOT//////////////////////////////////////////////////////
#include "TROOT.h"
#include "TApplication.h"
TROOT root("rint", "The ROOT Interactive Interface");
////////////////////////////////////////////////////////////////
int main() {
TApplication app("App","My Root Program");
return 0;
}
and didn't compile with KCC nor with root> .L <filename>.C++
In advance, Thank you !!
Ricardo
--
--------------------------------------------------------------------
Ricardo Eusebi
High Energy Physics
University of Rochester
Fermilab, (630) 840 8622
--------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET