What bit of initilization code am I missing?

Hi,
I have a small bit of stand-alone code that does the following:

main()
{
gSystem->CompileMacro(“query.cxx”, “k”);
}

If I add “gROOT->ProcessLine(”");" before that line the compile almost always works (not 100%).

Many bits of ROOT work w/out doing any extra initialization, but obviously not this bit (see errors below, from a Windows system). What initalization am I missing?

Info in <TWinNTSystem::ACLiC>: creating shared library C:\Users\gwatts\Documents \test\query_cxx.dll 26926_cint.cxx Error in <TWinNTSystem::DynamicPathName>: scanner does not exist in C:\Program F iles (x86)\Microsoft F#\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 10. 0\VSTSDB\Deploy;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files (x8 6)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework \v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Micro soft Visual Studio 10.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop; C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools ;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Prog ram Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;C:\Program Files\Common Files\M icrosoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Share d\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Window s\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.A CE\Core-Static;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Pr ogram Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files \TortoiseSVN\bin;C:\Program Files (x86)\TortoiseHg\;C:\Program Files (x86)\CVSNT \;c:\root\bin;.;c:\root/bin;;c:\root/lib;c:\root/cint/cint/stl, or has wrong file extension (.dll) query_cxx_ACLiC_dict.cxx Creating library C:\Users\gwatts\Documents\test\query_cxx.lib and object C:\U sers\gwatts\Documents\test\query_cxx.exp Error in <TWinNTSystem::DynamicPathName>: scanner does not exist in C:\Program F iles (x86)\Microsoft F#\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 10. 0\VSTSDB\Deploy;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files (x8 6)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework \v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Micro soft Visual Studio 10.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop; C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools ;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Prog ram Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;C:\Program Files\Common Files\M icrosoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Share d\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Window s\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.A CE\Core-Static;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Pr ogram Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files \TortoiseSVN\bin;C:\Program Files (x86)\TortoiseHg\;C:\Program Files (x86)\CVSNT \;c:\root\bin;.;c:\root/bin;;c:\root/lib;c:\root/cint/cint/stl, or has wrong file extension (.dll) cl : Command line warning D9035 : option 'o' has been deprecated and will be rem oved in a future release cl : Command line warning D9035 : option 'o' has been deprecated and will be rem oved in a future release cl : Command line warning D9002 : ignoring unknown option '-ignore:4049,4075,408 9,4217,4221' cl : Command line warning D9002 : ignoring unknown option '-incremental:no' cl : Command line warning D9002 : ignoring unknown option '-debug' cl : Command line warning D9002 : ignoring unknown option '-nodefaultlib:msvcrt. ...

Thanks in advance!!

Hi,

creating a TApplication object should fix it.

Cheers, Axel.

I’m writing a library. Is there any way for me to tell if the TApplication object is already initalized? Or does it matter if two of them get initalized?

Hi,

Look at the value of gApplication.

Cheers,
Philippe.

Duh! Thanks!

Ok, doing a “new TApplication” does fix the problem.

However, checking first to see if gApplication is 0 doesn’t work - it is not null in the code. So, I still need to do the new TApplication. Perhaps some other check? Or it doesn’t matter if new TApplication is run twice?

Cheers, Gordon.

Ok. This is what I should be doing (at least, this is what I found in other code in ROOT) to init the app:

TApplication::CreateApplication();

And that has an internal check of some sort. More importantly, it seems to work well. :slight_smile: