Archived

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

Visual Studio 6 and .NET not fully comptabible?

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

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 on other sites
6 has some wierd quirks. the more standard way of writing that is:

static const int foo = 7;

static before const. try that and see if 6 likes it.

-me

Share on other sites
nope.

it gives exact same error.

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 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 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.

1. 1
2. 2
3. 3
4. 4
Rutin
18
5. 5

• 14
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631423
• Total Posts
3000005
×