I have a problem using canvases when Im compiling my code (with ACLiC). The program below causes segmentation faults when I run it. Im using ROOT v4.0. Thankful for suggestions!
I cannot reproduce your problem.
Just in case you name your file test.C, could you check if you also have a file test.h that is not related to test.C ?
root [8] .L test.C++
Warning in : unmodified script has already been compiled and loaded
Warning in : it will be regenerated and reloaded!
Info in TUnixSystem::ACLiC: creating shared library /proton_home/hofverbe/SEASA/analysis/./test_C.so
root [9] test()
Warning in TH1::Build: Replacing existing histogram: h (Potential memory leak).
*** Break *** segmentation violation
Generating stack trace…
0x4011d332 in TExec::TExec(char const*, char const*) + 0x3a from /usr/local/root/lib/libCore.so
0x40cf9d6b in TPad::AddExec(char const*, char const*) + 0xd1 from /usr/local/root/lib/libGpad.so
0x4189281c in test() + 0x11c from /proton_home/hofverbe/SEASA/analysis/./test_C.so
0x41892957 in from /proton_home/hofverbe/SEASA/analysis/./test_C.so
0x406ae94a in G__call_cppfunc + 0x263 from /usr/local/root/lib/libCint.so
0x4069e292 in G__interpret_func + 0x6ee from /usr/local/root/lib/libCint.so
0x406864f3 in G__getfunction + 0x194f from /usr/local/root/lib/libCint.so
0x4067d512 in G__getitem + 0x5f1 from /usr/local/root/lib/libCint.so
0x4067c0fa in G__getexpr + 0x783e from /usr/local/root/lib/libCint.so
0x406c3710 in G__exec_function + 0x1d5 from /usr/local/root/lib/libCint.so
0x406ca35d in G__exec_statement + 0x23eb from /usr/local/root/lib/libCint.so
0x40665493 in G__exec_tempfile_core + 0x2ce from /usr/local/root/lib/libCint.so
0x40665670 in G__exec_tempfile_fp + 0x22 from /usr/local/root/lib/libCint.so
0x406d24f8 in G__process_cmd + 0x4575 from /usr/local/root/lib/libCint.so
0x4019220d in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xa9 from /usr/local/root/ lib/libCore.so
0x40104060 in TApplication::ProcessLine(char const*, bool, int*) + 0x596 from /usr/local/root/lib/lib Core.so
0x4100df8d in TRint::HandleTermInput() + 0x1dd from /usr/local/root/lib/libRint.so
0x4100cede in TTermInputHandler::Notify() + 0x24 from /usr/local/root/lib/libRint.so
0x4100e8bc in TTermInputHandler::ReadNotify() + 0x12 from /usr/local/root/lib/libRint.so
0x401fb8b5 in TUnixSystem::CheckDescriptors() + 0x143 from /usr/local/root/lib/libCore.so
0x401fae8f in TUnixSystem::DispatchOneEvent(bool) + 0x161 from /usr/local/root/lib/libCore.so
0x4015fb94 in TSystem::InnerLoop() + 0x18 from /usr/local/root/lib/libCore.so
0x4015fb39 in TSystem::Run() + 0x6f from /usr/local/root/lib/libCore.so
0x40104ad4 in TApplication::Run(bool) + 0x32 from /usr/local/root/lib/libCore.so
0x4100da89 in TRint::Run(bool) + 0x327 from /usr/local/root/lib/libRint.so
0x0804886d in main + 0x71 from /usr/local/root/bin/root.exe
0x42015574 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
0x0804876d in _Unwind_Resume + 0x31 from /usr/local/root/bin/root.exe
Root >
Are you sure that the script you posted is teh one that you execute?
In the tracback, I see that your script calls TPad::AddExec, but
I do not see this call in your first post !!
root [8] .L test.C++
Warning in <ACLiC>: unmodified script has already been compiled and loaded
I see that you had executed 7 other commands before this command.
Could you type the same command as the first command of your session and send the traceback?
root [0] .L test.C++
Info in TUnixSystem::ACLiC: creating shared library /proton_home/hofverbe/SEAS
A/analysis/./test_C.so
root [1] test()
*** Break *** segmentation violation
Generating stack trace…
0x4011d332 in TExec::TExec(char const*, char const*) + 0x3a from /usr/local/roo
t/lib/libCore.so
0x40cf9d6b in TPad::AddExec(char const*, char const*) + 0xd1 from /usr/local/ro
ot/lib/libGpad.so
0x4189081c in test() + 0x11c from /proton_home/hofverbe/SEASA/analysis/./test_C
.so
0x41890957 in from /proton_home/hofverbe/SEASA/analysis/./test_C.so
0x406ae94a in G__call_cppfunc + 0x263 from /usr/local/root/lib/libCint.so
0x4069e292 in G__interpret_func + 0x6ee from /usr/local/root/lib/libCint.so
0x406864f3 in G__getfunction + 0x194f from /usr/local/root/lib/libCint.so
0x4067d512 in G__getitem + 0x5f1 from /usr/local/root/lib/libCint.so
0x4067c0fa in G__getexpr + 0x783e from /usr/local/root/lib/libCint.so
0x406c3710 in G__exec_function + 0x1d5 from /usr/local/root/lib/libCint.so
0x406ca35d in G__exec_statement + 0x23eb from /usr/local/root/lib/libCint.so
0x40665493 in G__exec_tempfile_core + 0x2ce from /usr/local/root/lib/libCint.so
0x40665670 in G__exec_tempfile_fp + 0x22 from /usr/local/root/lib/libCint.so
0x406d24f8 in G__process_cmd + 0x4575 from /usr/local/root/lib/libCint.so
0x4019220d in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xa9
from /usr/local/root/lib/libCore.so
0x40104060 in TApplication::ProcessLine(char const*, bool, int*) + 0x596 from /
usr/local/root/lib/libCore.so
0x4100df8d in TRint::HandleTermInput() + 0x1dd from /usr/local/root/lib/libRint
.so
0x4100cede in TTermInputHandler::Notify() + 0x24 from /usr/local/root/lib/libRi nt.so
0x4100e8bc in TTermInputHandler::ReadNotify() + 0x12 from /usr/local/root/lib/l ibRint.so
0x401fb8b5 in TUnixSystem::CheckDescriptors() + 0x143 from /usr/local/root/lib/ libCore.so
0x401fae8f in TUnixSystem::DispatchOneEvent(bool) + 0x161 from /usr/local/root/
lib/libCore.so
0x4015fb94 in TSystem::InnerLoop() + 0x18 from /usr/local/root/lib/libCore.so
0x4015fb39 in TSystem::Run() + 0x6f from /usr/local/root/lib/libCore.so
0x40104ad4 in TApplication::Run(bool) + 0x32 from /usr/local/root/lib/libCore.s
o
0x4100da89 in TRint::Run(bool) + 0x327 from /usr/local/root/lib/libRint.so
0x0804886d in main + 0x71 from /usr/local/root/bin/root.exe
0x42015574 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
0x0804876d in _Unwind_Resume + 0x31 from /usr/local/root/bin/root.exe
Root >
0x40cf9d6b in TPad::AddExec(char const*, char const*) + 0xd1 from /usr/local/root/lib/libGpad.so
0x4189081c in test() + 0x11c from /proton_home/hofverbe/SEASA/analysis/./test_C.so
while you code does not contain any mention to AddExec.
I recommend that you first re-try in debug mode:
root [0] .L test.C++gIf the result is still similar then you have an environment … most likely $LD_LIBRARY_PATH, $PATH, $ROOTSYS and/or the compiler version are not all correctly set.