Sign in to follow this  
iam73

C2371 Redefinition errors after upgrading to VS2010 SP1

Recommended Posts

iam73    105
Hi guys,


I'm in the process of converting an old game VC6 project to VS2010. Yesterday I was finally able to fix all compile errors and started debugging, only to find out VS2010 was having quite a hard time in the process.

After some research on the MS site, I found my issue in the VS2010 SP1 fixes, so I installed it, rebooted and rebuilt my project. Since the SP1 update, I get the following error when compiling:


[font="Courier New"]error C2371: 'D3DCOLORVALUE' : redefinition; different basic types


[font="Arial"]I know what it means and I found the culprit, the thing is, I don't know how to fix it... I'm still learning and trying to find my way in VS and c++...


The project I'm working with was built around DX7. In order to build it in VS2010, I'm using the include and lib folders of the DX7 SDK in my project (VC++ Directories). The DX7 include and lib is 1st in the list of directories.

D3DCOLORVALUE is defined in one of the DX7 headers (d3dtypes.h) but also in one of Windows SDK header (d2dBaseTypes.h). So this is where the error comes from. Why I wasn't getting it before, no idea...

I tried hiding the d3dtypes.h file from the project but then it generated a bunch of new errors. So I tried hiding d2dbasetypes.h but then it complained that it couldn't find it during building.

I thought I had read in another thread here that the order of the directories was what was determining where to look for the definitions, so for example if I put the DX7 include path first in the directorties, and D3DCOLORVALUE is found in d3dtypes.h, it would use that definition during compilation and don't bother about the others, but I must have understood something wrong...[/font]

[/font]So now I'm a bit lost... I've googled about this since yesterday and couldn't find a way to fix that issue.... Isn't that strange also that before the SP1 update, it was working fine... the d2dbastypes is not a new file part of SP1, I even have it in the older 7.0a SDK include directory...


Any thought ?

Share this post


Link to post
Share on other sites
iam73    105
[quote name='iam73' timestamp='1307118048' post='4819123']
Hi guys,


I'm in the process of converting an old game VC6 project to VS2010. Yesterday I was finally able to fix all compile errors and started debugging, only to find out VS2010 was having quite a hard time in the process.

After some research on the MS site, I found my issue in the VS2010 SP1 fixes, so I installed it, rebooted and rebuilt my project. Since the SP1 update, I get the following error when compiling:


[font="Courier New"]error C2371: 'D3DCOLORVALUE' : redefinition; different basic types


[font="Arial"]I know what it means and I found the culprit, the thing is, I don't know how to fix it... I'm still learning and trying to find my way in VS and c++...


The project I'm working with was built around DX7. In order to build it in VS2010, I'm using the include and lib folders of the DX7 SDK in my project (VC++ Directories). The DX7 include and lib is 1st in the list of directories.

D3DCOLORVALUE is defined in one of the DX7 headers (d3dtypes.h) but also in one of Windows SDK header (d2dBaseTypes.h). So this is where the error comes from. Why I wasn't getting it before, no idea...

I tried hiding the d3dtypes.h file from the project but then it generated a bunch of new errors. So I tried hiding d2dbasetypes.h but then it complained that it couldn't find it during building.

I thought I had read in another thread here that the order of the directories was what was determining where to look for the definitions, so for example if I put the DX7 include path first in the directorties, and D3DCOLORVALUE is found in d3dtypes.h, it would use that definition during compilation and don't bother about the others, but I must have understood something wrong...[/font]

[/font]So now I'm a bit lost... I've googled about this since yesterday and couldn't find a way to fix that issue.... Isn't that strange also that before the SP1 update, it was working fine... the d2dbastypes is not a new file part of SP1, I even have it in the older 7.0a SDK include directory...


Any thought ?
[/quote]


What I ended up doing is this: I copied the D3DCOLORVALUE struct from the Windows SDK D2DBaseTypes.h into the DX7 d3dtypes.h and now it compiles fine... I'm debugging to see if it introduced any new problems.
Obviously I want to port this old code to an up-to-date DX version, but I wanted to have it compile/work in VS2010 using DX7 first...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this