"redefinition; different type modifier" in VS2010

brneuro picture brneuro · Mar 3, 2012 · Viewed 16.2k times · Source

I'm trying to compile some code I downloaded in visual studio. The code was intended for msvc 6, and I imported it to VS2010. The code is for providing ASIO support for labview by compiling a DLL. see here for the whole code.

I get the following error when building: "error C2373:'_pctype' : redefinition; different type modifiers."

The code snippet is as follows:

unsigned short _Ints[ 512 ];
unsigned short *_pctype = _Ints;

If anyone will be referencing the package of code from the link I provided, this is from the file GenMonCIN.c

Answer

fredoverflow picture fredoverflow · Mar 3, 2012

The error message is trying to tell you that _pctype was already defined somewhere else.

It appears that _pctype is an identifier used by Visual Studio since at least version 2005.

_pctype, _pwctype, _wctype, _mbctype, _mbcasemap

These global variables contain information used by the character classification functions. They are for internal use only.

Please never pick names with a leading underscore at namespace scope, they are reserved for the implementation. The person who wrote the library obviously didn't know that, and now you're screwed.