Hi, You must create a TApplication object, as shown in the file below Rene Brun #include "TApplication.h" #include "TSystem.h" #include "TEnv.h" #include "TH1.h" #include "TCanvas.h" #include <iostream> using namespace std; int main(int argc, char* argv[]) { cout << " Using ROOTSYS " << gSystem->Getenv("ROOTSYS") << endl; cout << " Using DYNAMIC PATH " << gEnv->GetValue("WinNT.*.Root.DynamicPath","NOT DEFINED") << endl; cout << " Using MACRO PATH " << gEnv->GetValue("WinNT.*.Root.MacroPath","NOT DEFINED") << endl; TApplication app("app",0,0); TCanvas can("toto","titi",300,300); TH1F histo("histo","histo",10,0,10); histo.Draw(); gPad->Update(); app.Run(); int i; cin >> i; return 0; } "ANCIANT E." wrote: > > Hello rooters, > > I installed root 3.10.02 / gdk on windows 2K / Visual C++ (ver. 6), > after using for a couple of year root 3.02 > and now I cannot get Canvas to pop up : > > I got the "idenfied problem with old version of VC6", but until I get the > Service pack installed, I managed > to have things compile with some workarround > > I also saw on the roottalk digest that proper compilation options are of > importance > for the newer version of root (for root3.02 I used default Visual options, > and > it worked fine) > So I tried to stick to the options given in Makefile.win32 > > The compilator command obtained by tricking trough Visual GUIs is : > > cl /G5 /MD /GR /I "p:\root_v3.10.02.win32gdk_Debug/include" /D "WIN32" /D > "_DEBUG" /D "_WIN32" /D "_MT" /D "VISUAL_CPLUSPLUS" /D "_WINDOWS" > /Fo"Debug/" /Fd"Debug/" /FD /EHsc /c > "P:\APS_LOCAL\TESTROOT\TestConsole\TestConsole.cpp" > > the linker options are (however I don't know how visual internaly > differentiate > Lib and Link commands) : > > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib > shell32.lib ole32.lib oleaut32.lib > uuid.lib odbc32.lib odbccp32.lib gdk-1.3.lib glib-1.3.lib libCint.lib > libCore.lib libEG.lib libEGPythia6.lib libfreetype.lib libFumili.lib > libGeom.lib libGeomPainter.lib libGpad.lib libGraf.lib libGraf3d.lib > libGui.lib libHbook.lib libHist.lib libHi > stPainter.lib libHtml.lib libMatrix.lib libMinuit.lib libMLP.lib > libPhysics.lib libPostscript.lib libProof.lib libProofGui.lib libRFIO.lib > libRGL.lib libRint.lib libTable.lib libTree.lib libTreePlayer.lib > libTreeViewer.lib libVMC.lib libWin32gdk.lib > /pdb:none /debug /machine:IX86 "/out:Debug/TestConsole.exe" > "/libpath:p:/root_v3.10.02.win32gdk_Debug/lib" -opt:ref > /subsystem:console,4.0 > .\Debug\TestConsole.obj > > My test example : > > // > #include "TPad.h" > #include "TSystem.h" > #include "TEnv.h" > #include "TH1.h" > #include "TCanvas.h" > > #include <iostream> > using namespace std; > > int main(int argc, char* argv[]) > { > cout << " Using ROOTSYS " << gSystem->Getenv("ROOTSYS") << endl; > cout << " Using DYNAMIC PATH " > << gEnv->GetValue("WinNT.*.Root.DynamicPath","NOT DEFINED") > << endl; > cout << " Using MACRO PATH " > << gEnv->GetValue("WinNT.*.Root.MacroPath","NOT DEFINED") << > endl; > > TCanvas can("toto","titi",300,300); > > TH1F histo("histo","histo",10,0,10); > histo.Draw(); > gPad->Update(); > int i; > cin >> i; > > return 0; > } > > THE CONSOLE OUPUT IS : > > Using ROOTSYS p:\root_v3.10.02.win32gdk_Debug > Using DYNAMIC PATH > .;p:\root_v3.10.02.win32gdk_Debug/bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\Sy > stem32\Wbem;C:\DLL-PWB-OLD;C:\DLL-PWB-NEW;w:\oracle\ora81\bin;w:\oracle\jre\ > 1.1.7\bin;W:\ORAWIN\BIN;p:\root_v3.10.02.win32gdk_Debug\bin;p:\vni\cnl50\bin > ;p:\rcs;p:\AnciantLocal\FTCCDSensor;p:\anciantlocal\simualgo\main\bin;p:\bin > Using MACRO PATH .;p:\root_v3.10.02.win32gdk_Debug/macros > Warning in <TWinNTSystem::SetProgname>: Wrong Program path > > Note the Warning : I found a reference of such a warning in Roottalk Message > from Marc de Kamps of Feb 25, 2003 > the answer of Fons Rademakers hinted on problems in Dynamic and Macro paths > which I checked, but I did not find anything looking wrong to me. > (in particular I did not find any .rootrc file in my disk ) > > I would realy appreciate some help > > thanks in advance > > eric > > PS : > > The following program using Root 3.02 worked : > > // TestConsole.cpp : Defines the entry point for the console application. > // > #include "TPad.h" > #include "TSystem.h" > #include "TEnv.h" > #include "TH1.h" > #include "TCanvas.h" > > #include <iostream.h> > > int main(int argc, char* argv[]) > { > cout << " Using ROOTSYS " << gSystem->Getenv("ROOTSYS") << endl; > cout << " Using DYNAMIC PATH " > << gEnv->GetValue("WinNT.*.Root.DynamicPath","NOT DEFINED") > << endl; > cout << " Using MACRO PATH " > << gEnv->GetValue("WinNT.*.Root.MacroPath","NOT DEFINED") << > endl; > > TCanvas can("toto","titi",300,300); > > TH1F histo("histo","histo",10,0,10); > histo.Draw(); > gPad->Update(); > int i; > cin >> i; > > return 0; > } > > The compilation OPTIONS were defaults of visual : > > /nologo /MLd /W3 /Gm /vmg /GX /ZI /Od /I "$(ROOTSYS)/include" /D "WIN32" /D > "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/TestConsole.pch" /YX /Fo"Debug/" > /Fd"Debug/" /FD /GZ /c > > The link OPTIONS were defaults of Visual : > > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib > libCint.lib libCore.lib libEG.lib libEGPythia.lib libGpad.lib libGraf.lib > libGraf3d.lib libGui.lib libHist.lib libHistPainter.lib libHtml.lib > libMatrix.lib libMinuit.lib libPhysics.lib libPostscript.lib libProof.lib > libRFIO.lib libRGL.lib libRint.lib libTree.lib libTreePlayer.lib > libTreeViewer.lib /nologo /subsystem:console /incremental:yes > /pdb:"Debug/TestConsole.pdb" /debug /machine:I386 > /out:"Debug/TestConsole.exe" /pdbtype:sept /libpath:"p:/root_v3.02/lib" > > I got no warning at compilation > > The output of the executable on the console is : > > Using ROOTSYS p:\root_v3.02 > Using DYNAMIC PATH > .;p:\root_v3.02/bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\DLL > -PWB-OLD;C:\DLL-PWB-NEW;w:\oracle\ora81\bin;w:\oracle\jre\1.1.7\ > bin;W:\ORAWIN\BIN;p:\root_v3.02\bin;p:\vni\cnl50\bin;p:\rcs;p:\AnciantLocal\ > FTCCDSensor;p:\anciantlocal\simualgo\main\bin;p:\bin > Using MACRO PATH .;p:\root_v3.02/macros > the current keyboard layout is 850 > > And I got my canvas pop up !
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET