Article ID: 127900 - View products that this article applies to.
This article was previously published under Q127900
Using _declspec(dllexport) or _declspec(dllimport) on a class with multiple static variable definitions may cause a C2487 error to be generated on all but the first variable. For example, consider this class declaration:
This class declaration generates these errors:
error C2487: 'j' : member of dll interface class may not be declared with dll interface
error C2487: 'k' : member of dll interface class may not be declared with dll interface
Move each static variable declaration to its own line. To fix the above class so that it will compile cleanly, use this:
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Article ID: 127900 - Last Review: July 5, 2005 - Revision: 1.1
Contact us for more help
Connect with Answer Desk for expert help.