java导致页面崩溃_java – LWJGL:打开窗口导致程序崩溃

我试图在

Java / LWJGL中制作一个简单的游戏.我正在关注在Windows上制作的教程,我正在使用mac.我复制了他的代码,为角色打开了一个窗口角色,程序立即崩溃,给了我一个很长很奇怪的错误,可能与指针有关(我实际上并不知道).以下是创建窗口的行,我在其中使用了属性中定义宽度和高度的窗口:

window = glfwCreateWindow(width, height, "Flappy Bird", NULL, NULL);

当我在我的Mac上运行它时,它给了我这个错误:

2015-10-12 13:18:38.475 java[496:31875] *** Assertion failure in + [NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1154/Misc.subproj/NSUndoManager.m:340

2015-10-12 13:18:38.476 java[496:31875] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.

2015-10-12 13:18:38.476 java[496:31875] (

0 CoreFoundation 0x00007fff98c3003c __exceptionPreprocess + 172

1 libobjc.A.dylib 0x00007fff9620a76e objc_exception_throw + 43

2 CoreFoundation 0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106

3 Foundation 0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195

4 Foundation 0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156

5 AppKit 0x00007fff96ecbb95 -[NSApplication run] + 756

6 libglfw.dylib 0x000000010d597974 initializeAppKit + 1332

7 libglfw.dylib 0x000000010d597035 _glfwPlatformCreateWindow + 37

8 libglfw.dylib 0x000000010d59397b glfwCreateWindow + 443

9 ??? 0x0000000104411eee 0x0 + 4366343918

10 ??? 0x0000000104406929 0x0 + 4366297385

11 ??? 0x0000000104406929 0x0 + 4366297385

12 ??? 0x0000000104406929 0x0 + 4366297385

13 ??? 0x000000010440685a 0x0 + 4366297178

14 ??? 0x0000000104406d34 0x0 + 4366298420

)

2015-10-12 13:18:38.477 java[496:31875] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1154/Misc.subproj/NSUndoManager.m:340

2015-10-12 13:18:38.477 java[496:31875] An uncaught exception was raised

2015-10-12 13:18:38.477 java[496:31875] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.

2015-10-12 13:18:38.477 java[496:31875] (

0 CoreFoundation 0x00007fff98c3003c __exceptionPreprocess + 172

1 libobjc.A.dylib 0x00007fff9620a76e objc_exception_throw + 43

2 CoreFoundation 0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106

3 Foundation 0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195

4 Foundation 0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156

5 AppKit 0x00007fff96ecbc41 -[NSApplication run] + 928

6 libglfw.dylib 0x000000010d597974 initializeAppKit + 1332

7 libglfw.dylib 0x000000010d597035 _glfwPlatformCreateWindow + 37

8 libglfw.dylib 0x000000010d59397b glfwCreateWindow + 443

9 ??? 0x0000000104411eee 0x0 + 4366343918

10 ??? 0x0000000104406929 0x0 + 4366297385

11 ??? 0x0000000104406929 0x0 + 4366297385

12 ??? 0x0000000104406929 0x0 + 4366297385

13 ??? 0x000000010440685a 0x0 + 4366297178

14 ??? 0x0000000104406d34 0x0 + 4366298420

)

2015-10-12 13:18:38.478 java[496:31875] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'

*** First throw call stack:

(

0 CoreFoundation 0x00007fff98c3003c __exceptionPreprocess + 172

1 libobjc.A.dylib 0x00007fff9620a76e objc_exception_throw + 43

2 CoreFoundation 0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106

3 Foundation 0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195

4 Foundation 0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156

5 AppKit 0x00007fff96ecbc41 -[NSApplication run] + 928

6 libglfw.dylib 0x000000010d597974 initializeAppKit + 1332

7 libglfw.dylib 0x000000010d597035 _glfwPlatformCreateWindow + 37

8 libglfw.dylib 0x000000010d59397b glfwCreateWindow + 443

9 ??? 0x0000000104411eee 0x0 + 4366343918

10 ??? 0x0000000104406929 0x0 + 4366297385

11 ??? 0x0000000104406929 0x0 + 4366297385

12 ??? 0x0000000104406929 0x0 + 4366297385

13 ??? 0x000000010440685a 0x0 + 4366297178

14 ??? 0x0000000104406d34 0x0 + 4366298420

)

libc++abi.dylib: terminating with uncaught exception of type NSException

还会弹出一个窗口,上面写着“java在使用libglfw.dylib插件时意外退出”.

我安装LWJGL是错误还是我的代码存在缺陷?谢谢您的帮助!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值