I’m trying to do a very simple Hello World type example while trying to compile it outside of root and get it to run. I’ve managed to compile a considerably longer and more complicated thing (a little muon lifetime analysis project) just fine, so I don’t think it’s a problem with the environment/libraries/compiler, I think I’m just managing to do something wrong.
I’m using the 5.15.06 release on Windows with Visual C++ 8.
I run the following commands:
vcvars32.bat (sets up my environment)
cl hello_world.cpp -c -I C:\root\include -Fohello_world.o
link hello_world.o -LIBPATH:C:\root\lib libCore.lib
and it compiles and links just fine. Yet when I run hello_world.exe, I get this:
So, does that mean that I need to make a GUI-based application if I’m using a TString?
Also, I noticed after fiddling around in the $ROOTSYS/test folder that the TString.cxx also gives the same stack trace problem when compiled with the VC++ compiler.
After using the TApplication object, as you suggested, it no longer produces a stack trace; however, for future reference, does this mean that I need to stay away from using TString’s to produce output to the console, or is there something else that I can do to prevent the crash?
You must have something badly wrong in your environment. For this simple
program you do not need TApplication (I was assuming that your program contains more)
I have no problems doing (in my $ROOTSYS directory)
How weird :S. Are you using VC++ 8? Maybe it has something to do with a version conflict…
I had the Platform SDK in my include/lib path, so I removed it, and it still gives me the stack trace after compilation. Here’s what I did, just to make sure:
Copy/pasted the previous code into the $ROOTSYS directory (in order to mirror what you did as much as I could)
ran vcvars32.bat. Here is the contents of that, just for the record:
and then ran hollings.exe. It gave me the same stack trace. I went back and manually set the LIB, LIBPATH and INCLUDE variables with only the completely necessary paths, and the same thing happened.
Are there any other environment things that could influence the program into dying like that?
Did you install ROOT yourself with VC++8?
You cannot run a version compiled with VC++7 on a system with VC++8.
You cannot mix code compiled in debug mode with code compiled in non-debug mode (yes, this is Microsoft).
We provide a tar file compiled in non-debug mode with VC++8 at
http:/root.cern.ch/root/Version515.html