Why do I get the error "error: unknown type name 'virtual'" when trying to compile this code? Why do I get the error "error: unknown type name 'virtual'" when trying to compile this code? xcode xcode

Why do I get the error "error: unknown type name 'virtual'" when trying to compile this code?


Please rename the main.m to main.mm. This worked for me.


If you're using Xcode 4, try changing the name of file "AppDelegate.m" to "AppDelegate.mm". It works for me.


Changing the name of file "AppDelegate.m" to "AppDelegate.mm". It's correct!