root [2] .x test1.C
Info in : unmodified script has already been compiled and loaded
Info in : it will be regenerated and reloaded!
Info in TWinNTSystem::ACLiC: creating shared library c:\root\macros\choleskynewmacros\test1_cc.dll
24204144_cint.cxx
test1_cc_ACLiC_dict.cxx
c:\root\macros\choleskynewmacros\test1.cc(4) : error C2039: ‘cout’ : is not a member of 'std’
c:\root\macros\choleskynewmacros\test1.cc(4) : error C2065: ‘cout’ : undeclared identifier
Error in : Compilation failed!
Error: Function test1(a) is not defined in current scope C:\root\macros\test1.C(5)
*** Interpreter error recovered ***
my two macros are
test1.C in C:\root\macros\test1.C
{ gSystem->AddIncludePath("-Ic:\root\macros\choleskynewmacros");
gSystem->CompileMacro(“test1.cc”,“f”);
int a=10;
cout<<test1(a)<<endl;
}
#include
int * memallot (int L)
{
int * mat;
mat = new int [L];
return mat;
getchar();
}
this works fine on root prompt when I do .L memallo.C and .x memallot.C(10), it returns a memory address
but when I call it from another macro test1.C
{ gSystem->AddIncludePath("-Ic:\root\macros");
gSystem->CompileMacro(“memallot.C”,“f”);
int a=10;
cout<<memallot(a)<<endl;
}
I get “1” back, I believe this is true or false value. Please suggest how can I get the address value of the allotted value of memory from memallot.C to test1.C
nothing is automatically included by a compiler (e.g. when called by ACLiC in your examples), CINT interpreter knows some includes automatically, though - see “CINT the C++ Interpreter” chapter in ROOT User’s Guide http://root.cern.ch/drupal/content/users-guide
your “memallot.C” + “test1.C” example works fine for me
> root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.28/00f 4 August 2011 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
ROOT 5.28/00f (branches/v5-28-00-patches@40439, Aug 11 2011, 10:50:00 on linux)
CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .x test1.C
Info in <TUnixSystem::ACLiC>: creating shared library /.../memallot_C.so
0x9c97670
root [1] .q
>
Thank You very much, I did learn a lot. I wonder why my program which runs on window does not return a memory address. Thank you for supporting the community.
Thank You Phillipie, I think I will move on to linux, my professor said “geez” when I informed that I have installed root on windows. I do have a question on that, I will post on a separate thread. Thank You for patiently answering the questions.