RE: Compiling a root macro like a c++ program

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Wed, 11 Apr 2007 13:46:55 +0200


Hi,  

You should not call your executable "test". On linux, if you try to execute your program by typing "test" it will perform a shell test and will do nothing. Call your main program with an other name or type "./test" to execute the program.  

Cheers, Olivier Couet


From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of John Zoidberg Sent: Tuesday, April 10, 2007 10:35 AM
To: roottalk_at_root.cern.ch
Subject: [ROOT] Compiling a root macro like a c++ program

I would like to make programs using ROOT classes, but compiled with the gcc/g++ compilers instead of this weird ACLiC/CINT system. I tried to understand the Makefile of the "test" folder with all the example programs, but it looks completely obscure to me.

So I just tried reusing the command lines used when running this makefile, to compile a simple "hello world" program containing no ROOT code a all for the moment:

g++ -O -Wall -fPIC -pthread
-I/misc/cbmsoft/Debian3.1/new/tools/root/include -c test.cxx
g++ -O test.o /u/mtaverne/root_compilation/libEvent.so
-L/misc/cbmsoft/Debian3.1/new/tools/root/lib -lCore -lCint -lHist -lGraf
-lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread
-lm -ldl -rdynamic -o test

Here's the test.cxx file:

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>

int main(int argc, char **argv)
{
  cout<<"Hello World!"<<endl;
  return(0);
}
(It includes more headers than needed, but that shouldn't be a problem.)

What I don't understand is that it does get compiled, but when I execute it, it displays nothing (whereas it does when I compile it with a simple "g++ test.cxx"). Received on Wed Apr 11 2007 - 13:47:02 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 11 2007 - 17:50:01 CEST