Link to home
Start Free TrialLog in
Avatar of oddbin
oddbin

asked on

Visibroker 6 causing "member function already defined or declared" error

Hello ,

I am currently trying to build my project using Visbroker 6.0 but keep receiving the following error.

d:\6.0\include\viostrm.h(85) : error C2535: 'class VISistream &__thiscall VISistream::operator >>(unsigned short &)' : member function already defined or declared
        d:\6.0\include\viostrm.h(67) : see declaration of '>>'
d:\6.0\include\viostrm.h(112) : error C2535: 'class VISistream &__thiscall VISistream::get(unsigned short *,unsigned int)' : member function already defined or declared
        d:\6.0\include\viostrm.h(106) : see declaration of 'get'
d:\6.0\include\viostrm.h(194) : error C2535: 'class VISostream &__thiscall VISostream::operator <<(unsigned short)' : member function already defined or declared
        d:\6.0\include\viostrm.h(175) : see declaration of '<<'
d:\6.0\include\viostrm.h(218) : error C2535: 'class VISostream &__thiscall VISostream::put(const unsigned short *,unsigned int)' : member function already defined or declared
        d:\6.0\include\viostrm.h(212) : see declaration of 'put'

Etc...

I have this project build and running using Visibroker 5.1 and it all works fine in the very same envirnoment.

The 'idl' files for the 5.1 project were build using 5.1 and the same 'idl' files for the 6.0 project were built using 6.0.

I have an idea that my problem lies in that wchar_t is a typedef for unsigned short in VC++ 6, but if this were true i should have had problems when building the 5.1 project.

Does anyone have any solution to my problem ..

This is the piece of code to which the firts error refers too ...

#if defined(_VIS_UNICODE)
#if defined(_VIS_STREAM_WCHAR)
    virtual VISistream& operator>>(wchar_t& x);
#else
    virtual VISistream& operator>>(VISWChar& x);
#endif
    virtual VISistream& operator>>(wchar_t *& c);
    // get_wstring in mbuf only for now!!
    //virtual VISistream& get_wstring(wchar_t *& c);
#endif
Avatar of cup
cup

Looks like it is moaning about inline definitions in the header files.  

Also, just to be safe, make sure that the 5.1 headers are not in the include list in the tools options directories.  It may be mixing those up with your V6 headers.

Also, be warned that if you are using Unicode, TCHAR is 16 bits on Windows but 32 bits on many of the *nixs.
Avatar of oddbin

ASKER

From the borland website : http://info.borland.com/devsupport/bes/relnotes/6_0_preview/VBE60_Beta.html#VBC_FixList


Wide Char on Windows - Prior to MSVC7, wchar_t was not considered as a built-in type and was mapped to "unsigned short",
hence wrappers were created to differentiate "unsigned short" and wchar_t data.However in MSVC7 wchar_t is now corrected and is now considered a built-in type and this compliancy can be enabled by using the "/Zc:wchar_t" MSVC7 compilation switch. This switch is required for wchar_t compliancy as suggested by Microsoft.

In Summary , insert "/Zc:wchar_t" into the preprocessor defs in the C++ Project settings tab.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of amp072397
amp072397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial