Making a .dsp file fro ROOT development

Hi,

I am trying to make a .dsp file for making ROOT development.
I found an about two-year old post from Valeriy Onuchin (Valeri.Onoutchine@cern.ch) at Fri Aug 01 2003 - 17:15:21 MEST. I could not use the .dsp and .dsw files as described there and in addition it is just the project file version of the makefile. I wanted to make a usual project file.

If I comment out some lines, making the MFTest item ineffective, as shown below

[code]#include <TApplication.h>
#include <TGClient.h>
/*
#include “MFTest.h”

//______________________________________________________________________________
MFTest::MFTest( const TGWindow* p, UInt_t height, UInt_t width ) :
TGMainFrame( p, height, width )
{
// ctor

MapWindow();
}

//______________________________________________________________________________
MFTest::~MFTest()
{
// dtor
}

*/

//______________________________________________________________________________
int main(int argc, char** argv)
{
//
char nosplash[2] = {“mftest”,"-l"};
int n = 2;
TApplication application( “ROOT Application”, &n, (char
*)&nosplash);
// MFTest t(gClient->GetRoot());
application.Run();
return 0;
}
[/code]

the mftest.exe file bilds OK. When running, the DOS window comes up all right (although of course makes nothing).
If I run within the debugger, I receive the message

[quote]Warning in TWinNTSystem::SetProgname: Cannot find this program named “mftest.e
xe” (Did you create a TApplication? Is this program in your %PATH%?)
[/quote]

Can I avoid this message?
(although interesting that it is asked when the program executes the line
TApplication application( “ROOT Application”, &n, (char**)&nosplash);
)

In addition, if I remove the commented-out lines, I receive the error message

[quote]Linking…
mftest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MFTest::Streamer(class TBuffer &)” (?Streamer@MFTest@@UAEXAAVTBuffer@@@Z)
mftest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MFTest::ShowMembers(class TMemberInspector &,char *)” (?ShowMembers@MFTest@@UAEXAAVTMemberInspector@@PAD@Z)
mftest.obj : error LNK2001: unresolved external symbol “public: static class TClass * __cdecl MFTest::Class(void)” (?Class@MFTest@@SAPAVTClass@@XZ)
Debug/mftest.exe : fatal error LNK1120: 3 unresolved externals[/quote]

What is missing here and why?

Thanks for the help

Janos

Hi,

[quote=“jvegh”]I receive the message[quote]Warning in TWinNTSystem::SetProgname: Cannot find this program named “mftest.e
xe” (Did you create a TApplication? Is this program in your %PATH%?)
[/quote]Can I avoid this message?[/quote]Yes, and the warning tells you how: put it into your %PATH%.

[quote=“jvegh”][quote]Linking…
mftest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MFTest::Streamer(class TBuffer &)” (?Streamer@MFTest@@UAEXAAVTBuffer@@@Z)
mftest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MFTest::ShowMembers(class TMemberInspector &,char *)” (?ShowMembers@MFTest@@UAEXAAVTMemberInspector@@PAD@Z)
mftest.obj : error LNK2001: unresolved external symbol “public: static class TClass * __cdecl MFTest::Class(void)” (?Class@MFTest@@SAPAVTClass@@XZ)
Debug/mftest.exe : fatal error LNK1120: 3 unresolved externals[/quote]What is missing here and why?[/quote]The dictionary is missing, probably because you either didn’t create it (using rootcint) or because you didn’t link it.

Axel.

[quote][quote=“Axel”]Hi,

[quote=“jvegh”]I receive the message[quote]Warning in TWinNTSystem::SetProgname: Cannot find this program named “mftest.e
xe” (Did you create a TApplication? Is this program in your %PATH%?)
[/quote]Can I avoid this message?[/quote]Yes, and the warning tells you how: put it into your %PATH%.[/quote]

Could you please also tell why? I mean why an application I create must be on my %PATH%? The more I learn about ROOT the less I understand the principles behind it. I see it contains a lot of valuable material, it tries to be user-friendly, but I cannot catch the philosophy behind it. Are they written anywhere?

I wanted to make a possible simplest application, with one empty frame. In all other frameworks I know it is possible to write a ‘Hello World’ in a couple of lines, without special c-like interpreter, without dictionaries, placing on path, etc.
Is it possible at all to use the ROOT framework as a normal class library, without the need of CINT, dictionaries, ACLiC, and who knows what?
OK, I understand that CINT is made fro non-professionals, but is it a must to use it?
Is it possible to create a simple executable, which can be anywhere in the directory structure, using just a simple compiler and linker?

Making development with this system is just a pain for me. I have lost some days until I could find out that CINT is not able to handle 2dim arrays if the first dimension is >4. A lot of restrictions, a lot of unnecessary allowances. I do not like CINT, but it seems that I cannot avoid it.

I wanted to read some data, using a parser, because the item terminators may be different. I was offered to use ready-made data-fill facility, where I am not able to change even the item terminator and there is no string tokenizer object available.

Maybe (surely!) you are right. The only problem that I until now could not figure out what is the dictionary and especially why do I need it if I want to avoid using CINT, not speaking about how to explain it to the linker that I want to use such a …)khm) something, specific to ROOT. I especially browsed the user’s guide and found nothing about what is its function, content, what is its definition. In all occurrences it is mentioned with CINT like a “CINT dictionary”.

I attempted a couple of times to ask if I can use ROOT in the same way as some other known toolkits. How can I use it in some non-CINT way. How can I build an exe, which can be used without installing ROOT. How can I use the MS integrated development sysetm with ROOT. Tried to dig in the archive, the maximum I found was a wrapper around the makefile.
In addition, I could not make it work.

Could you please also tell why? I mean why an application I create must be on my %PATH%?[/quote]
ROOT tries to set the gProgPath, the path to the binary, but it doesn’t find it. That’s all. I cannot find any part of root using it (except for RootShower), so for root itself it’s not relevant. I will send in a mod that removes the warning.

I cannot follow you here - why is an (unnecessary) warning a philosophy?

Partly - it depends on what you want to do. I’m pretty sure (though I didn’t look into it) that e.g. the signal slot mechanism of the GUI part of root depends on Cint dictionaries.

You underestimate bot the power of Cint, and it’s use in root. There is no must, but you seem to have a ClassDef, and that means you’ll have to use a dictionary. Try to remove the ClassDef. Depending on your application it will either break things (which means you need the ClassDef and the dictionary) or it will just work. The Users’ Guide nicely explains under what contditions a ClassDef is needed (menus, Streamer,…)

Yes.

As I said, it depends. You’re right - the Cint limitations page is essential to know. But I have not found any piece of code that cannot be re-written to make it parsable by Cint.

Maybe (surely!) you are right. The only problem that I until now could not figure out what is the dictionary and especially why do I need it if I want to avoid using CINT, not speaking about how to explain it to the linker that I want to use such a …)khm) something, specific to ROOT. I especially browsed the user’s guide and found nothing about what is its function, content, what is its definition. In all occurrences it is mentioned with CINT like a “CINT dictionary”.[/quote]
I used the “search” link on the main root web page, and entered “dictionary -roottalk” into the google text box. This was the first link showing up: http://root.cern.ch/root/CintGenerator.html. It explains how to generate it, and how to link it into your own binary.

The dictionary describes a class. It allows the transition between names (e.g. “TObject”) and C++ classes (e.g. TObject) in both ways (e.g. gROOT->GetClass(“TObject”)->New() or obj->GetClass()->GetName()), it allows access to the layout of types (e.g. obj->GetClass()->GetListOfMethods()), and a few more things. For what it’s used for in ROOT (which also tells you in what cases ti’s needed) you can search the Users’ Guide for “ClassDef” and “dictionary”. Without knowing what exactly you’re trying to do I cannot tell you whether you need a dictionary or not. But for the simplest applications you don’t. You are right - this should show up somewhere in the Users’ Guide. I couldn’t find it either. I’ll suggest it to be added (but so could you :wink:

That probably won’t work, at least not to my knowledge, as most libraries depend on libCore and libCint, and libCint needs extra files, not just the libraries. Think of it like using g++ - nobody would just copy the g++ binary and complain that it doesn’t compile things :wink:

[quote=“jvegh”]How can I use the MS integrated development sysetm with ROOT. Tried to dig in the archive, the maximum I found was a wrapper around the makefile.
In addition, I could not make it work.[/quote]
ROOT is provided with a Makefile. ROOT is pretty comlpex, and so is its build system. Mirroring the build system in a native MSVC solution has been talked about several times, but up to now everybody trying this has decided that the effort to get it done is a lot greater than the pain using a wrapper for a Makefile.

It also depends what you want to do - do you want to build ROOT inside an MSVC solution? Or do you want to build your binary using ROOT inside MSVC? For the first see my page, for the latter see Francois-Xavier’s page, both linked from http://root.cern.ch/root/HowtoWindows.html.

Cheers, Axel.

[quote=“Axel”]

[quote=“jvegh”]How can I use the MS integrated development sysetm with ROOT. Tried to dig in the archive, the maximum I found was a wrapper around the makefile.
In addition, I could not make it work.[/quote]
ROOT is provided with a Makefile. ROOT is pretty comlpex, and so is its build system. Mirroring the build system in a native MSVC solution has been talked about several times, but up to now everybody trying this has decided that the effort to get it done is a lot greater than the pain using a wrapper for a Makefile.

It also depends what you want to do - do you want to build ROOT inside an MSVC solution? Or do you want to build your binary using ROOT inside MSVC? For the first see my page, for the latter see Francois-Xavier’s page, both linked from http://root.cern.ch/root/HowtoWindows.html.

Cheers, Axel.[/quote]

Well, I was thinking about a third option: just to develop my app using ROOT classes as any other app on Win32 platform. Finally, I succeeded to do it, see the attachment.

In this way I can see as my variables change their values, can set breakpoints, can see the call stack, etc. Also, I do not have the need (and the pain) to re-write my code for CINT. The only thing I am not satisfied with is that I do not see the effects of the graphic commands like Draw(), but I think it comes from the implementation of ROOT.

Regards

Janos
mftest.zip (3.18 KB)

Hi,
all that’s needed is the proper link line plus proper dir settings (so VC finds root’s files) for building your own app. To get graphics you’ll have to link with the graphics libs. root-config --glibs tell me that this should go into your link line to make graphics work:

-include:_G__cpp_setupG__Hist -include:_G__cpp_setupG__Graf1 -include:_G__cpp_setupG__G3D -include:_G__cpp_setupG__GPad -include:_G__cpp_setupG__Tree -include:_G__cpp_setupG__Rint -include:_G__cpp_setupG__PostScript -include:_G__cpp_setupG__Matrix -include:_G__cpp_setupG__Physics -include:_G__cpp_setupG__Gui1 ‘%ROOTSYS%\lib\libCore.lib’ ‘%ROOTSYS%\lib\libCint.lib’ ‘%ROOTSYS%\lib\libHist.lib’ ‘%ROOTSYS%\lib\libGraf.lib’ ‘%ROOTSYS%\lib\libGraf3d.lib’ ‘%ROOTSYS%\lib\libGpad.lib’ ‘%ROOTSYS%\lib\libTree.lib’ ‘%ROOTSYS%\lib\libRint.lib’ ‘%ROOTSYS%\lib\libPostscript.lib’ ‘%ROOTSYS%\lib\libMatrix.lib’ ‘%ROOTSYS%\lib\libPhysics.lib’ ‘%ROOTSYS%\lib\libGui.lib’

You might have to replace %ROOTSYS% by its value on your machine.
Cheers, Axel.

[quote=“Axel”]Hi,
all that’s needed is the proper link line plus proper dir settings (so VC finds root’s files) for building your own app. To get graphics you’ll have to link with the graphics libs.

[/quote]

Sorry, I was not precise enough. Of course the proper links and includes are necessary.
I mean that I see the graphics only when the application Run() starts. Maybe I will have to override this method and call my stuff there, rather than before creating the TApplication.

Janos

Hi,
yes, graphics output will only appear when calling TApplication::Run; see the chapter on “writing a GUI / standalone version” in the users’ guide. This is one of the reasons why building your own binaries is not the recommended way of executing code; “.x myCode.C+” (and/or loading libs etc) is.
Axel.