Re: Msvc compilation errors

Alex Rousskov <[email protected]> Wed, 8 Sep 2004 09:37:48 -0600 (MDT)
Newsgroups gmane.comp.parsers.hapy.user
Message-ID <[email protected]>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-187378011-1094657856=:26617
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; FORMAT=flowed
Content-ID: <20040908093737.T26617-LbpN3Auhdh+Rtz+nHKFJDvXmoG9oyoYx@public.gmane.org>

Srinidhi,

 	I am not sure what causes the errors you quoted. It seems to 
be related to the Hapy use of the std_bidirectional_iterator template. 
It is not the first time that supposed-to-be-portable STL construct 
causes compilation troubles. Perhaps my code in PreeKids.h uses 
std_bidirectional_iterator interface the wrong way.

 	Attached is a patch that might help. It changes
 	std::iterator_traits<PreeKidsIterator>
in typedefs to more explicit
 	std::iterator_traits< PreeKidsIterator<Base> >

The patch does not cause compilation problems with GCC 2.95. I do not 
have access to MSVC. Please let me know whether the patch helps in 
your case. I doubt the patch helps, but it does not hurt to try.

 	FWIW, there are many Hapy users building Hapy with MS 
compilers. I wonder if there is some MSVC version compatibility issue 
here? What version do you use?

 	If anybody has better std_bidirectional_iterator knowledge or 
workaround suggestions please chime in!

Thank you,

Alex.

-- 
Protocol performance, functionality, and reliability testing.
Tools, services, and know-how.
http://www.measurement-factory.com/

On Wed, 8 Sep 2004, srinidhi wrote:

> Hi
> I am trying to build the hapy parser library under MSVC windows. 
> I am getting the following errors: 
> Compiling...
> Algorithm.cpp
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 
> ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 
> ) : error C2146: syntax error : missing ';' before identifier 
> 'iterator_category'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 
> ) : error C2868: 'iterator_category' : illegal syntax for using-declaration; 
> expected qualified-name
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 
> ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 
> ) : error C2146: syntax error : missing ';' before identifier 'value_type'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 
> ) : error C2868: 'value_type' : illegal syntax for using-declaration; 
> expected qualified-name
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 0) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 0) : error C2146: syntax error : missing ';' before identifier 
> 'difference_type'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 0) : error C2868: 'difference_type' : illegal syntax for using-declaration; 
> expected qualified-name
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 1) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 1) : error C2146: syntax error : missing ';' before identifier 'pointer'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 1) : error C2868: 'pointer' : illegal syntax for using-declaration; expected 
> qualified-name
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 2) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 2) : error C2146: syntax error : missing ';' before identifier 'reference'
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 
> 2) : error C2868: 'reference' : illegal syntax for using-declaration; 
> expected qualified-name
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see 
> reference to class template instantiation '_STL::iterator_traits<class 
> Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(32) : warning C4284: 
> return type for 'Hapy::PreeKidsIterator<class Hapy::Pree>::operator ->' is 
> 'int' (ie; not a UDT or reference to a UDT.  Will produce errors if applied 
> using infix notation)
>      d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference 
> to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' 
> being compiled
> d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2839: invalid 
> return type 'int' for overloaded 'operator ->'
> d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2227: left of 
> '->rid' must point to class/struct/union
> d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(115) : error C2102: '&' 
> requires l-value
> d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(116) : error C2664: 
> 'find_first' : cannot convert parameter 1 from 'int' to 'const class 
> Hapy::Pree &'
>      Reason: cannot convert from 'int' to 'const class Hapy::Pree'
>      No constructor could take the source type, or constructor overload 
> resolution was ambiguous
> Error executing cl.exe. 
>
> What is the fix for this?? 
> regards
> Srinidhi 
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> Hapy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hapy-users
>
--0-187378011-1094657856=:26617
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="PreeKids.h.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <20040908093736.G26617-LbpN3Auhdh+Rtz+nHKFJDvXmoG9oyoYx@public.gmane.org>
Content-Description: PreeKids.h.patch
Content-Disposition: ATTACHMENT; FILENAME="PreeKids.h.patch"

SW5kZXg6IHNyYy9pbmNsdWRlL0hhcHkvUHJlZUtpZHMuaA0KPT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PQ0KUkNTIGZpbGU6IC91c3IvbG9jYWwvQ1ZTL1RtZkJh
c2UvSGFweS9zcmMvaW5jbHVkZS9IYXB5L1ByZWVLaWRzLmgsdg0KcmV0cmll
dmluZyByZXZpc2lvbiAxLjEyDQpkaWZmIC11IC1yMS4xMiBQcmVlS2l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c2U+ID46
Oml0ZXJhdG9yX2NhdGVnb3J5IGl0ZXJhdG9yX2NhdGVnb3J5Ow0KKwkJdHlw
ZWRlZiB0eXBlbmFtZSBzdGQ6Oml0ZXJhdG9yX3RyYWl0czxQcmVlS2lkc0l0
ZXJhdG9yPEJhc2U+ID46OmRpZmZlcmVuY2VfdHlwZSBkaWZmZXJlbmNlX3R5
cGU7DQorCQl0eXBlZGVmIHR5cGVuYW1lIHN0ZDo6aXRlcmF0b3JfdHJhaXRz
PFByZWVLaWRzSXRlcmF0b3I8QmFzZT4gPjo6dmFsdWVfdHlwZSB2YWx1ZV90
eXBlOw0KKwkJdHlwZWRlZiB0eXBlbmFtZSBzdGQ6Oml0ZXJhdG9yX3RyYWl0
czxQcmVlS2lkc0l0ZXJhdG9yPEJhc2U+ID46OnBvaW50ZXIgcG9pbnRlcjsN
CisJCXR5cGVkZWYgdHlwZW5hbWUgc3RkOjppdGVyYXRvcl90cmFpdHM8UHJl
ZUtpZHNJdGVyYXRvcjxCYXNlPiA+OjpyZWZlcmVuY2UgcmVmZXJlbmNlOw0K
IA0KIAlwdWJsaWM6DQogCQlQcmVlS2lkc0l0ZXJhdG9yKCk6IGN1cnJlbnQo
MCksIGlkeCgwKSB7fQ0K

--0-187378011-1094657856=:26617--


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click