我正在尝试将Objective-C与C++混合使用.当我编译代码时,我得到了几个错误.
啊
#import <Cocoa/Cocoa.h>
#include "B.h"
@interface A : NSView {
B *b;
}
-(void) setB: (B *) theB;
@end
Run Code Online (Sandbox Code Playgroud)
上午
#import "A.h"
@implementation A
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect {
// Drawing code here.
}
-(void) setB: (B *) theB {
b = theB;
}
@end
Run Code Online (Sandbox Code Playgroud)
BH
#include <iostream>
class B {
B() {
std::cout << "Hello from C++";
}
};
Run Code Online (Sandbox Code Playgroud)
以下是错误:
/Users/helixed/Desktop/Example/B.h:1:0 /Users/helixed/Desktop/Example/B.h:1:20: …Run Code Online (Sandbox Code Playgroud) 我想在MacOSX中打开一个OpenGL窗口(以显示和抓取击键/鼠标事件).
我不想使用Glut(因为它要求它是根线程).
我不想学习Objective C.
反正有无法在纯C中访问OpenGL api吗?
谢谢!
不使用多平台库,例如 GLUT 或 SDL。
在 C 中(没有 Objective-C),如何创建一个带有可以绘制的有效 OpenGL 上下文的窗口?
我希望能够从命令行编译它,所以请不要使用 XCode 拖放内容!