I was following a tutorial at https://riptutorial.com/opengl/example/13875/creating-opengl-4-1-with-cplusplus-and-cocoa but the project won't build. I may guess that XCode is mixing up my Cpp and Obj-C files. In Application.hpp it suggests replacing "class" with Obj-C "Class" and adding a semicolon, and in MacApp.h it can't find memory to include.
I've been struggling with it for some time, but couldn't find a solution.
Application.hpp
#include <OpenGL/gl3.h>
class Application { // Suggests "Class" and a semicolon
private:
GLuint program;
GLuint vao;
public:
Application();
void update();
~Application();
};
MacApp.h
#import <Cocoa/Cocoa.h>
#import "Application.hpp"
#import <memory> // Error here
NSApplication* application;
@interface MacApp : NSWindow <NSApplicationDelegate>{
std::shared_ptr<Application> appInstance;
}
@property (nonatomic, retain) NSOpenGLView* glView;
-(void) drawLoop:(NSTimer*) timer;
@end
UPD: changing Cpp standard library from libstdc++ to libc++(LLVM...) and moving app pointer into the main.m file fixed the problem