Re: Root and MSVC++

From: Valery Fine (fine@bnl.gov)
Date: Wed Sep 30 1998 - 21:02:11 MEST


On 30 Sep 98 at 11:39, S.P. Wakely wrote:


> Date:          Wed, 30 Sep 1998 11:39:01 -0400 (EDT)
> From:          "S.P. Wakely" <sw@dirac.hep.umn.edu>
> To:            fine@mail.cern.ch
> Cc:            roottalk@hpsalo.cern.ch
> Subject:       Re: Root and MSVC++


>> Use the default project flags and attempt to compile in debug mode.

>> It will not compile, bombing out with a series of errors in TGXW.h:

>> c:/root/include\TGXW.h(161) : warning C4003: not enough actual parameters for macro 'CreateWindowA'
>> c:/root/include\TGXW.h(161) : error C2059: syntax error : 'constant'
>> c:/root/include\TGXW.h(329) : warning C4003: not enough actual parameters for macro 'CreateWindowA'
>> c:/root/include\TGXW.h(329) : error C2275: 'Window_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'Int_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'Int_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'UInt_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'UInt_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'UInt_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'Int_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2275: 'UInt_t' : illegal use of this type as an expression
>> c:/root/include\TGXW.h(329) : error C2062: type 'void' unexpected

>> I think the main question is can you use MSVC-based GUI objects
>> (dialogs, buttons, etc.) in the same application as you use Root-based GUI
>> objects (canvas, pad, etc...)?

>> As I said, I suspect I am missing something obvious here.
 
  Your message has TWO question in fact.

  1. The first is why you got the troubles with the compilation.
     Very likely you mess some include files. The line 161 gave us a clue.
     It says about CreateWindowA. I am sure the class TGXW has no 
CreateWindowA at all but it does contain the method introduced recently:

  virtual Window_t  CreateWindow(Window_t parent, Int_t x, Int_t   y)

  From another hand MS VC does define the MACRO (!!!) CreateWindow and
  does expand this macro to CreateWindowA (!!!). It is not only clash between
  Microsoft macro names and ROOT method names. One may find the list of them with 
  Windows4Root.h file supplied. As you can see this problem did solve (somehow) 
  when we compile ROOT ourselves and can not figure out what ROOT include file 
  and which way you lost.
  What is clear the C-preprocessor did substitute the name of the TGXW::CreateWindow
  method with CreateWindows VC++ macro. All other your error messages have the same
  nature, namely some ROOT include file was missed with your project.
  You may scan *.h to find out where all *_t types are defined (Rtypes.h my guess)
  (may be your project sets the "pre-compiled" header option or something like this).

  Please check.

  2. The second "main" question has no anwser. Something like "if you can you may".
      For example see http://glast.phys.washington.edu/~haas/windows%20active.html
      Anyway ROOT itself does use some MSVC-base GUI objects. For 
      example open (create) TCanvas object and select "File"->"Save 
      as". You will get "standard" MSVC "Save As" dialog box". try 
      form the command line (or from the Context "right-mouse" menu) 
      to invoke the Inspect() method of any ROOT object you'll get 
      the "standard" ListView control etc etc.

      From another hand you should understand if ROOT creates Windows 
      it does create and supply the "event loop" and  "Windows      
      procedure" to manage Windows messages from them. To take 
      over that TCanvas procedure your GUI object  must 
      respond the messages your GUI object will generate.    
      This means one wants to use the MS "GUI" object within      
      Canvas  he should create a C++ object and customize the ROOT    
      "Windows procedure"  to manage the expected messages. From      
      another hand I see no problem to create a separate      
      "non-Canvas"/"pure" WIN32 Window within any user's class and    
      play with that independ of "ROOT" way. From  this ROOT is a   
      "normal" C++ program and your classes will be a normal C++    
      classes.

      I'd like to stress the primary goal (my understanding) of the 
      ROOT project was to       hide the platform specific things. By 
      "ROOT" the user's code       should not manipulate with either 
      special things like X11       or WIN32. Therefore there is no 
      method to bring the       "external" Windows (WIN32, X11, 
      Motif, etc ) specific object       into the "platform" 
      independed TCanvas one.

         Hope this helps,
                               Valery

  I would advice to try to create a DLL with your classes and 
  ROOT/CINT dictionary and load them into ROOT seesion. My guess they 
  will work.
=================================================================
Dr. Valeri Faine (Fine)
    -------------------          Phone: +1 516 344 7806
Brookhaven National Laboratory   FAX  : +1 516 344 4206
Bldg. 510A /STAR                 mailto:fine@bnl.gov
Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
USA
                                 
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su                              



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET