4

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

genpfault
  • 51,148
  • 11
  • 85
  • 139
brneuro
  • 326
  • 1
  • 5
  • 15
  • 1
    It sounds like there are two variables called _pctype in the same scope. This could compiler in an earlier versions of MSVC if the first variable was declared inside a for statement, for instance, but it's difficult to tell without the surrounding code. Rather than digging into the library you're using, listing the relevant code here would be a real help. Specifically, can you cite the function in which the error occurs? – John McFarlane Mar 02 '12 at 23:21
  • 1
    thx for the suggestion JMcF, but there are no other occurrences. If you need further information, I did actually site the function in which this error occurs in my original post. – brneuro Mar 03 '12 at 14:16

1 Answers1

8

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.

Community
  • 1
  • 1
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
  • okay... thx, i can see the problem in that case. but why am I screwed, can't I just rename the variable to something else? strangely enough, "_pctype" doesn't appear in the project any where else except for at this declaration. I'm not sure why the authors' have made this declaration to be honest, the only other information I can supply is that after the "_Ints" declaration, this is commented"// Sound buffer code makes ref to these externals, but doesn't supply" – brneuro Mar 03 '12 at 14:14