1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main()
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
// NSApplication* app = [NSApplication sharedApplication];
//Create the main window
NSRect rc = NSMakeRect(0, 0, 800, 600);
NSUInteger uiStyle = NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask;
NSBackingStoreType backingStoreStyle = NSBackingStoreBuffered;
NSWindow* win = [[NSWindow alloc] initWithContentRect:rc styleMask:uiStyle backing:backingStoreStyle defer:NO];
[win setTitle:@"测试字符串"];
[win makeKeyAndOrderFront:win];
[win makeMainWindow];
//Start the event loop by calling NSApp run
[NSApp run];
[pool drain];
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19TARGET = hello
CFLAGS ?= -std=c99 -Wall -Wextra -pedantic -I./
TARGET_OS ?= $(OS)
ifeq ($(TARGET_OS),Windows_NT)
else ifeq ($(shell uname -s),Linux)
else ifeq ($(shell uname -s),Darwin)
WEBVIEW_CFLAGS := -x objective-c
WEBVIEW_LDFLAGS := -framework Cocoa -framework WebKit
endif
$(TARGET): main.m
$(CC) $(CFLAGS) $(WEBVIEW_CFLAGS) main.m $(LDFLAGS) $(WEBVIEW_LDFLAGS) -o $@
clean:
rm -f $(TARGET)