Let’s say this basic example is in a file named arg_test.C:
[code]#include
using namespace std;
int main(const int argc, const char **argv) {
int a = argc;
cout << "a: " << a << endl;
char*b = argv[0];
cout << "b: " << b << endl;
}[/code]
And it runs with the following commands:
[mwoods] $ root
root [1] .L arg_test.C
root [2] main(23,"test")
a: 23
*** Break *** segmentation violation
b:
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
Thread 1 (process 15571):
#0 0x00007fff804dac90 in wait4 ()
#1 0x00007fff804ef23e in system ()
#2 0x000000010011e818 in TUnixSystem::StackTrace ()
#3 0x000000010011c19a in TUnixSystem::DispatchSignals ()
#4 <signal handler called>
#5 0x00007fff80460180 in strlen ()
#6 0x0000000100af0e58 in G__G__stream__0_25 ()
#7 0x000000010093cc86 in Cint::G__ExceptionWrapper ()
#8 0x00000001009fbf9c in G__execute_call ()
#9 0x00000001009fc3db in G__call_cppfunc ()
#10 0x00000001009d6413 in G__interpret_func ()
#11 0x00000001009bf263 in G__getfunction ()
#12 0x0000000100a17634 in G__overloadopr ()
#13 0x0000000100a18692 in G__bstore ()
#14 0x00000001009a3587 in G__getexpr ()
#15 0x0000000100a22132 in G__exec_statement ()
#16 0x00000001009d7c35 in G__interpret_func ()
#17 0x00000001009bf263 in G__getfunction ()
#18 0x00000001009933aa in G__getitem ()
#19 0x0000000100997ad7 in G__getexpr ()
#20 0x0000000100a2a41e in G__exec_statement ()
#21 0x000000010097ed86 in G__exec_tempfile_core ()
#22 0x000000010097f096 in G__exec_tempfile_fp ()
#23 0x0000000100a33f54 in G__process_cmd ()
#24 0x000000010002b23e in TCint::ProcessLine ()
#25 0x000000010007b7eb in TApplication::ProcessLine ()
#26 0x00000001012fadbf in TRint::HandleTermInput ()
#27 0x00000001012f9397 in TTermInputHandler::Notify ()
#28 0x00000001012fb2bd in TTermInputHandler::ReadNotify ()
#29 0x000000010011be62 in TUnixSystem::CheckDescriptors ()
#30 0x000000010011c365 in TUnixSystem::DispatchOneEvent ()
#31 0x00000001000b6d7d in TSystem::InnerLoop ()
#32 0x00000001000b89f3 in TSystem::Run ()
#33 0x0000000100079e57 in TApplication::Run ()
#34 0x00000001012f9ffb in TRint::Run ()
#35 0x00000001000019a0 in main ()
===========================================================
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007fff80460180 in strlen ()
===========================================================
Root > Function main() busy flag cleared
I’m trying to write code I can compile with g++ without ROOT libraries but also have run-able from the ROOT CLI for those so inclined. Why does this standard syntax not work?