Hello fellow root-users,
I have written a program that makes use several root-libraries as well as a simple makefile (Makefile.txt (374 Bytes)
) to compile the program. I’m able to compile my programs without any problem. However, today I have encountered a strange situation when I try to add a simple grid to my graph. In my compiled program the method “SetGrid()” only adds one grid perpendicular to the x-axis. Here is a minimal working example that reproduces the problem on my system:
test.cpp (367 Bytes)
And here the pdf file created by the program:
If I run the same code from above in the root-interpretator I obtain the desired result with the correct representation.
Where is my problem here?
One Remark: Not only “SetGrid()” is causing me problems in compiled root programs but “SetLog()” and “SetTicks()” as well.
Right after “g->Draw();”, try to add:
thank you for your reply. I have changed the code according to your recommendations, unfortunately this does not fix my problem. However, today I have compiled the source code on another system that has the very same root-version installed on it. This time the program generated the correct output, so there must be something wrong with my system or my root-version is corrupted.
Does anyone knows a solution for this problem or should I consider reinstalling root?
You can try reinstalling ROOT to make sure it is not an installation problem.
If the problem still appears then it might be that somewhere (in your code or in ROOT) there is an uninitialized memory used leading to ‘random’ behavior. To understand whether it is the case you can run your example under valgrind (if you are running the root executable make sure to use the one (literrally) named root.exe).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.