1

It seems that in last Visual Studio interface is now a keyword of some sort. I don't really know why, neither I can find such a keyword in C++ or C++11 standard, but using variable with name "interface" produces following error:

error C2332: 'struct' : missing tag name

Renaming the variables from interface to something like my_interface fixed the problem, but isn't there a way to compile it without having to modify the code?

Petr
  • 12,279
  • 14
  • 74
  • 131

2 Answers2

2

Actually interface is not a C++ keyword defined by the standard, it is an extension in Visual Studio (which goes all the way back to VS2005 as far as I know). This will therefore not compile on other compilers if they do not have such an extension, in which case you must remove it.

The various ways to declare an interface in a C++ standard manner are described here

Edit
It seems I misunderstood your question, and you instead want to use variables named interface without Visual Studio thinking you are declaring an interface.

In that case, compile with the /Za flag to disable compiler extensions.

Cory Kramer
  • 98,167
  • 13
  • 130
  • 181
  • 1
    I probably didn't form the question properly. My problem is not with using "interface" anywhere else. My problem is that the code is already using this variable name "interface" somewhere and thus doesn't compile in Visual Studio where it's a keyword. The source code is perfectly valid according to standards and cross compile everywhere, except for last Visual Studio – Petr Sep 21 '15 at 13:47
1

Looks like it's an extension of visual studio for C++:

https://msdn.microsoft.com/en-us/library/737cydt1.aspx

Try to disable language extension (by passing a /Za):

https://msdn.microsoft.com/en-us/library/0k0w269d.aspx

rkachach
  • 13,862
  • 5
  • 35
  • 55