LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: bogieman987 on November 17, 2014, 17:55:32

Title: [FIXED] GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: bogieman987 on November 17, 2014, 17:55:32
So I'm updating my project so that it uses the new LWJGL3 rather than 2.9.x.

I think I have most of the code that replaces "Display" set up right from following this http://www.lwjgl.org/guide and looking on the GLFW site, but when I try and run my code I get the following.
Exception in thread "Test" java.lang.UnsatisfiedLinkError: org.lwjgl.system.glfw.ErrorCallback$Util.setCallback(Ljava/lang/reflect/Method;)J
at org.lwjgl.system.glfw.ErrorCallback$Util.setCallback(Native Method)
at org.lwjgl.system.glfw.ErrorCallback$Util.<clinit>(ErrorCallback.java:61)
at GameEngine.Render.GameDisplay.createNewDisplay(GameDisplay.java:20)
at GameEngine.Render.Render.init(Render.java:56)
at GameEngine.Render.Render.<init>(Render.java:52)
at GameEngine.Render.DefaultRender.<init>(DefaultRender.java:26)
at GameEngine.GameEngine$Engine.initEngine(GameEngine.java:70)
at GameEngine.GameEngine$Engine.run(GameEngine.java:59)
at java.lang.Thread.run(Unknown Source)


The line that causes it is the following
GLFW.glfwSetErrorCallback(ErrorCallback.Util.getDefault());
Which is pretty much the first method called in the method, before that the only thing there is, is an initialized long variable, "window".

So what is the cause for the error?

Extra Info:
GameDisplay is a class containing static methods that are to do with window creation, atm there is a method "createNewDisplay" and "changeResolution".
Render is an abstract class that DefaultRender extends and then fully implements some of the methods.
Title: Re: GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: spasi on November 17, 2014, 17:58:57
Call Sys.touch(); before setting up the error callback. This is a temporary workaround and will be fixed soon, see this issue (https://github.com/LWJGL/lwjgl3/issues/17).
Title: Re: GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: bogieman987 on November 17, 2014, 18:00:27
Ah, ok, thanks.
Also, what can I call instead of GLU.gluErrorString()?
Edit:
Had a quick look through the API, would Uitl.translateGLErrorString(int errorCode) do the trick?
Title: Re: GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: spasi on November 17, 2014, 18:09:46
You can use org.lwjgl.opengl.Util.translateGLErrorString(int errorCode)
Title: Re: GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: bogieman987 on November 17, 2014, 18:13:01
Haha, you posted just before I finished editing my previous post.
And thanks.
Title: Re: GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: spasi on November 18, 2014, 11:28:47
The original issue has been resolved (https://github.com/LWJGL/lwjgl3/commit/e9e3b483268540af6d2bcc14dfeb2d0fc362d3f1), there is no need  anymore to call Sys.touch() explicitly.
Title: Re: [FIXED] GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: advanced_set on November 22, 2014, 17:23:23
quick report: got the same error (unsatisfied link error when calling glfwSetErrorCallback). Using Sys.touch fixed it. Using the stable release from the download page.
Title: Re: [FIXED] GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: spasi on November 22, 2014, 17:59:07
Have you tried with the latest nightly?
Title: Re: [FIXED] GLFW Error "java.lang.UnsatisfiedLinkError"
Post by: advanced_set on November 22, 2014, 19:33:03
just tried with the latest nightly (red, bleeding edge link!) and worked without the Sys.touch.

I could even register my own callback (scala):

glfwSetErrorCallback(new ErrorCallback.StrAdapter() {
      override def invoke(e: Int, d: String) = { quit(new RuntimeException(s"$e: $d")) }})