RE: [ROOT] Compile errors using root 3.05/3 with VC++

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 13 2003 - 22:20:36 MET


Hi Ed,

See remarks concerning the Windows versions of ROOT 3.05/03
at http://root.cern.ch

Rene Brun

On Thu, 13 Mar 
2003, Ed Oltman wrote:

> Valeri,
> 
> I have only the <fstream> include.  When I replace this with
> #include "Riostream.h", I do not get errors (3.05/3 or 3.05/2)
> but I get a bunch of warnings (shown at end of this file)  Here
> is a little sample program
> 
> //#include <fstream.h>      // <-- compiled in 3.05/2, not  3.05/3
> #include "Riostream.h"	    // <-- compiled in 3.05/2 and 3.05/3
> #include <stdlib.h>
> #include "TString.h"
> class Example
> {
> public:
> 	Example() {fFileName=fStr=0;}
> 	Example(const char *fname);
> 	~Example();
> private:
> 	TString *fFileName;
> 	TString *fStr;
> };
> Example::Example(const char *fname)
> {
> 	fFileName = new TString(fname);
> 	fstream fin(fFileName->Data(),ios::in);
> 	if(fin.good())
> 	{
> 		char *fs= new char[655360];
> 		cout << fFileName << " is open for reading"  << endl;
> 		fin.read(fs,655360);
> 		fStr=new TString(fs);
> 		delete [] fs;
> 		fin.close();
> 	}
> 	else
> 		cout << "Cannot open " <<  fFileName << " for reading" << endl;
> }
> Example::~Example()
> {
> 	if (fFileName) delete fFileName;
> 	if (fStr) delete fStr;
> }
> c:\program files\microsoft visual studio\vc98\include\istream(547) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
> c:\program files\microsoft visual studio\vc98\include\ostream(197) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\ostream(193) :
> while compiling class-template member function 'class
> std::basic_ostream<char,struct std::char_traits<char> > &__thiscall
> std::basic_ostream<char,struct std::char_traits<ch
> ar> >::operator <<(const void *)'
> c:\program files\microsoft visual studio\vc98\include\ostream(234) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\ostream(229) :
> while compiling class-template member function 'class
> std::basic_ostream<char,struct std::char_traits<char> > &__thiscall
> std::basic_ostream<char,struct std::char_traits<ch
> ar> >::put(char)'
> c:\program files\microsoft visual studio\vc98\include\ostream(234) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\ostream(229) :
> while compiling class-template member function 'class
> std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >
> &__thiscall std::basic_ostream<unsigned sh
> ort,struct std::char_traits<unsigned short> >::put(unsigned short)'
> c:\program files\microsoft visual studio\vc98\include\istream(336) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\istream(332) :
> while compiling class-template member function 'class
> std::basic_istream<char,struct std::char_traits<char> > &__thiscall
> std::basic_istream<char,struct std::char_traits<ch
> ar> >::read(char *,int)'
> c:\program files\microsoft visual studio\vc98\include\istream(46) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\istream(41) :
> while compiling class-template member function 'bool __thiscall
> std::basic_istream<char,struct std::char_traits<char> >::ipfx(bool)'
> c:\program files\microsoft visual studio\vc98\include\istream(46) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\istream(41) :
> while compiling class-template member function 'bool __thiscall
> std::basic_istream<unsigned short,struct std::char_traits<unsigned short>
> >::ipfx(bool)'
> c:\program files\microsoft visual studio\vc98\include\xstring(525) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\xstring(521) :
> while compiling class-template member function 'void __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::_Copy(unsigned int)'
> c:\program files\microsoft visual studio\vc98\include\xstring(525) : warning
> C4530: C++ exception handler used, but unwind semantics are not enabled.
> Specify -GX
>         c:\program files\microsoft visual studio\vc98\include\xstring(521) :
> while compiling class-template member function 'void __thiscall
> std::basic_string<unsigned short,struct std::char_traits<unsigned
> short>,class std::allocator<unsigned short
> > >::_Copy(unsigned int)'
> 
> temporary.obj - 0 error(s), 9 warning(s)
> 
> > -----Original Message-----
> > From: Faine, Valeri [mailto:fine@bnl.gov]
> > Sent: Wednesday, March 12, 2003 12:28 PM
> > To: 'Ed Oltman'; 'Roottalk@Pcroot. Cern. Ch'
> > Subject: RE: [ROOT] Compile errors using root 3.05/3 with VC++
> >
> >
> > He Ed,
> > Can you check whether you have any  <iostream> include files in your
> > code?
> > That should be replaced with #include "Riostream.h" from the
> > $ROOTSYS/include
> >
> >    Hope this helps,
> >                        Valeri
> >
> >
> > > -----Original Message-----
> > > From: owner-roottalk@pcroot.cern.ch
> > [mailto:owner-roottalk@pcroot.cern.ch]
> > > On Behalf Of Ed Oltman
> > > Sent: Wednesday, March 12, 2003 1:01 PM
> > > To: Roottalk@Pcroot. Cern. Ch
> > > Subject: [ROOT] Compile errors using root 3.05/3 with VC++
> > >
> > > Hello,
> > >
> > >
> > > I have code that uses #include <fstream.h> that compiled and ran fine
> > with
> > > version 3.03/9 and 3.05/2 but produced compile errors with 3.05/3
> > under
> > > visual c++ version 6 (win2K):
> > >
> > > c:\root\include\riosfwd.h(25) : error C2874: using-declaration causes
> > a
> > > multiple declaration of 'istream'
> > >         c:\program files\microsoft visual
> > studio\vc98\include\iosfwd(256)
> > > :
> > > see declaration of 'istream'
> > > c:\root\include\riosfwd.h(26) : error C2874: using-declaration causes
> > a
> > > multiple declaration of 'ostream'
> > >         c:\program files\microsoft visual
> > studio\vc98\include\iosfwd(257)
> > > :
> > > see declaration of 'ostream'
> > > c:\root\include\riosfwd.h(27) : error C2874: using-declaration causes
> > a
> > > multiple declaration of 'fstream'
> > >         c:\program files\microsoft visual
> > studio\vc98\include\iosfwd(270)
> > > :
> > > see declaration of 'fstream'
> > > c:\root\include\riosfwd.h(28) : error C2874: using-declaration causes
> > a
> > > multiple declaration of 'ifstream'
> > >         c:\program files\microsoft visual
> > studio\vc98\include\iosfwd(268)
> > > :
> > > see declaration of 'ifstream'
> > > c:\root\include\riosfwd.h(29) : error C2874: using-declaration causes
> > a
> > > multiple declaration of 'ofstream'
> > >         c:\program files\microsoft visual
> > studio\vc98\include\iosfwd(269)
> > > :
> > > see declaration of 'ofstream'
> > >
> > > The include section of the file is:
> > >
> > > #pragma warning (disable : 4800)
> > > #include <fstream.h>
> > > #include <stdlib.h>
> > >
> > > // ROOT includes
> > > #include "TString.h"
> > > #include "TSystem.h"
> > >
> > > //project include files
> > > #include "CIniFile.h"
> > >
> > > and CIniFile.h does not have any included.  Any idea of a solution?
> > > Thanks,
> > >
> > > Ed Oltman
> >
> >
> >
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET