Static lib problem probably


#1

Hi all, probably basic issue. So, I’ve got an app that uses cpp bindings to glfw. But it requires latest version of glfw. I have 3.1.2 at the moment, but downloaded and compiled libglfw from source. However I got: In function TWorld::OnKeyDown(int)': World.cpp:(.text+0x2505): undefined reference toglfwGetKeyName’ . Which, to my limited knowledge means that static lib hasn’t been updated. What should I do? System Linux, Debian-like, Ubuntu descendant, nvidia390.


#2

glfwGetKeyName was introduced in version 3.2, so if you downloaded the latest source package from http://www.glfw.org/download.html then you should have that function. You should be able to check the code you have to see.

However “undefined reference” is a linker error rather than a compile error. This means that the function declaration in the header was found, but there is some problem in matching that to a compiled function. This could be due to not linking with the right library - your program might be linking to the system installed library rather than the one you just compiled.


#3

Exactly. Maybe I described it a too vague way.
I found out that while the library compiles and installs without any apparent issue, it does not update libglfw.so . But only when installed from source. I just downloaded deb from distro up (I have stable derivative of Ubuntu 16.04, debs with libglfw 3.2.1 are in 18.04 and up). And installed from deb it worked like a charm. But from source there should be at least a warning of sorts.