[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 962
  • Last Modified:

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.

0
q3tech
Asked:
q3tech
  • 6
  • 5
1 Solution
 
AlexFMCommented:
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.

0
 
q3techAuthor Commented:
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.
0
 
AlexFMCommented:
Redefine COM_INTERFACE_ENTRY2 macro replacing static_cast with C-style cast.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
q3techAuthor Commented:
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)?
0
 
AlexFMCommented:
It is better to redefine this macro locally to make your program independent from Visual Studio installation.
0
 
q3techAuthor Commented:
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
0
 
AlexFMCommented:
In C++ - Language options there is "Treat wchat_t as Built-in Type". Try to change it.
0
 
q3techAuthor Commented:
while compiling "SPI_GETFOREGROUNDLOCKTIMEOUT" is undeclared. Why is it so in VC8.0?

SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)&dwTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
0
 
AlexFMCommented:
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?
0
 
q3techAuthor Commented:
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.
0
 
q3techAuthor Commented:
can i accept all ur answers somehow? actually it's showing only "comment" written over there.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now