Link to home
Start Free TrialLog in
Avatar of q3tech
q3tech

asked on

porting VC++ 6.0 Application to VC++ 8.0 which uses Boost library.

I've an application running in VC++ 6.0 which is using Boost library. I tried to port this application to VC++ 8.0 but had errors in Boost library while compiling the project.
I just opened my existing project in Visual Studio 2005 and it asked to convert my VC++ 6.0 project in VC++ 8.0. That's how i converted to VC++ 8.0.
Then i tried to build my project and it started giving me errors regarding boost library.

One of the errors is as below :

d:\source code 8.5.1 - visualstudio 2005\3pty\boost\boost\iterator_adaptors.hpp(1229) : warning C4346: 'std::iterator_traits<_Iter>::value_type' : dependent name is not a type
        prefix with 'typename' to indicate a type
d:\source code 8.5.1 - visualstudio 2005\3pty\boost\boost\iterator_adaptors.hpp(1229) : error C2923: 'boost::reverse_iterator_generator' : 'std::iterator_traits<_Iter>::value_type' is not a valid template type argument for parameter 'Value'

Can anybody help me out with this? it's lil urgent.

thx.

Avatar of AlexFM
AlexFM

MSDN, Compiler Warning (level 1) C4346:
The typename keyword is required if a dependent name is to be treated as a type. This is a breaking change in the Visual C++ .NET 2003 compiler, made in order to conform to the ISO C++ standard.

http://msdn2.microsoft.com/en-us/library/tsx7wabs.aspx

Take a look at C4346 description and add "typename" where it is necessary. I cannot say where exactly, because I don't see Boost code, but you can play with this. C4346 is key message here, adding "typename" solves also C2923 message.

Notice that this change is done according to C++ standard. Maybe you are using special Boost version for VC++ 6.0, which is not standard compliant, in this case you need to use other version.

Avatar of q3tech

ASKER

Following lines compiles perfectly in VC6.0 but gives errors in VC7.1.

BEGIN_COM_MAP(CDHTMLEvents)
    COM_INTERFACE_ENTRY2(HTMLElementEvents, IDHTMLEvents)
    COM_INTERFACE_ENTRY2(HTMLAnchorEvents, IDHTMLEvents)
    COM_INTERFACE_ENTRY2(HTMLButtonElementEvents, IDHTMLEvents)
    COM_INTERFACE_ENTRY(IDispatch)
    COM_INTERFACE_ENTRY(IDHTMLEvents)
END_COM_MAP()

one of the errors is :

error C2440: 'static_cast' : cannot convert from 'IDHTMLEvents *' to 'HTMLElementEvents *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

can anybody suggest me what can be done?

thx.
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

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
Avatar of q3tech

ASKER

I just replaced static_cast with reinterpret_cast in "atlcom.h"  and it worked.
Is it OK OR should i redefine it somewhere else (where)?
It is better to redefine this macro locally to make your program independent from Visual Studio installation.
Avatar of q3tech

ASKER

whar_t is defined as below:

typedef unsigned short   wchar_t; /*  Use a 2 byte definition  */

it's returniing the below error, how to fix this error :

error C2632: 'short' followed by 'wchar_t' is illegal
In C++ - Language options there is "Treat wchat_t as Built-in Type". Try to change it.
Avatar of q3tech

ASKER

while compiling "SPI_GETFOREGROUNDLOCKTIMEOUT" is undeclared. Why is it so in VC8.0?

SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)&dwTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
SPI_GETFOREGROUNDLOCKTIMEOUT
Windows NT and Windows 95:  This value is not supported.

For every functions or constants which are not supported in all operating systems see the following article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp

BTW, I already answered 4 questions here. Maybe it is time to accept an answer and open new question if necessary?
Avatar of q3tech

ASKER

i'm so sorry actually i'm using this site for the first time. I applied all ur answers but forgot to accept them here. thanx a lot for ur help.
Avatar of q3tech

ASKER

can i accept all ur answers somehow? actually it's showing only "comment" written over there.