Archived

This topic is now archived and is closed to further replies.

Visual Studio 6 and .NET not fully comptabible?

This topic is 5012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i ask this because whenever i take my work home (which has visual stuidio 6.0) i cant compile it without making any changes. for instance, on .NET i have a const static variable inside a class, and the whole program runs fine. but on 6.0 it complains about this.... here''s the error:
error C2258: illegal pure syntax, must be ''= 0''
and heres the snippet of code where it''s defined:
const static int m_itemMapIndex = 7;     

Share this post


Link to post
Share on other sites
.NET is significantly more standards compliant than 6.0. However this is really more relevant in more substantial areas of a C++ compiler, such as templates. So .NET and 6.0 C++ are not 100% compatible. As far as the static const values I cannot say for certain.

Share this post


Link to post
Share on other sites
i believe i solved it.

i had to do this in the header file:

const static int m_itemMapIndex;

...and then i had to define that again in the .cpp file, like this:

const int characterdlg::m_itemMapIndex = 7;

Funny, because i thought you could define static variables like that for basic datatypes. i guess this is a 6.0 feature.

thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by GekkoCube
i guess this is a 6.0 feature.



That would be a 6.0 mis feature.

In any case, another method is just to redeclare your constant as an enum in the class. You might prefer that if you want to have the actual value show up inside the class definition proper.

Share this post


Link to post
Share on other sites