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

后端 未结 7 2499
庸人自扰
庸人自扰 2021-02-14 01:41

Code:

struct IRenderingEngine {
    virtual void Initialize(int width, int height) = 0;
    virtual void Render() const = 0;
    virtual void UpdateAnimation(flo         


        
7条回答
  •  北荒
    北荒 (楼主)
    2021-02-14 01:57

    I moved the #import "IRenderingEngine.hpp" line from the GLView.h file to the GLView.mm - this prevented it from being imported into the main.m and HelloArrowAppDelegate.m files when they were compiled - and restricted the import into the .mm file, that could handle the C++.

    I also had to make a couple of other fixes for bugs I'd introduced when typing in the code - so apologies if that wasn't the only thing that needed to be done, but it might help those with similar problems!

提交回复
热议问题