[FIXED] GLFW Error "java.lang.UnsatisfiedLinkError"

Started by bogieman987, November 17, 2014, 17:55:32

Previous topic - Next topic

bogieman987

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.
Will soon be an Oracle Certified Associate :D

spasi

Call Sys.touch(); before setting up the error callback. This is a temporary workaround and will be fixed soon, see this issue.

bogieman987

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?
Will soon be an Oracle Certified Associate :D

spasi

You can use org.lwjgl.opengl.Util.translateGLErrorString(int errorCode)

bogieman987

Haha, you posted just before I finished editing my previous post.
And thanks.
Will soon be an Oracle Certified Associate :D

spasi

The original issue has been resolved, there is no need  anymore to call Sys.touch() explicitly.

advanced_set

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.

spasi


advanced_set

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")) }})