GLFW and LCCwin32

Hi,

I am new to Open GL and have installed the following on my computer :

a. GLFW
b. LCCwin32

I have done the following during the installation :

a. Installed lcc win32.

b. Downloaded a precompiled version of GLFW for LCC win32 and placed the two files glfw.lib to the lib directory and glfw.h to the include/gl directory of lcc win32.

I tried compiling the example files in the GLFW package in lcc win32 but the compiling was unsuccessful. Below is an excerpt from the error log file.

Error c:\glfw\examples riangle.c 24 undefined reference to _glfwInit
Error c:\glfw\examples riangle.c 27 undefined reference to _glfwOpenWindow
Error c:\glfw\examples riangle.c 29 undefined reference to _glfwTerminate
Error c:\glfw\examples riangle.c 34 undefined reference to _glfwEnable
Error c:\glfw\examples riangle.c 37 undefined reference to _glfwSwapInterval
Error c:\glfw\examples riangle.c 42 undefined reference to _glfwGetTime
Error c:\glfw\examples riangle.c 47 undefined reference to _glfwGetMousePos
Error c:\glfw\examples riangle.c 54 undefined reference to _glfwSetWindowTitle
Error c:\glfw\examples riangle.c 61 undefined reference to _glfwGetWindowSize
Error c:\glfw\examples riangle.c 97 undefined reference to _glfwSwapBuffers
Error c:\glfw\examples riangle.c 100 undefined reference to _glfwGetKey
Error c:\glfw\examples riangle.c 100 undefined reference to _glfwGetWindowParam
c:\lcc\bin\lcc.exe -c -Ic:\lcc\include -g2 c:\glfw\examples riangle.c
c:\lcc\bin\lcclnk.exe -subsystem console -o c:\glfw\examples\lcc1 riangle.exe triangle.obj GLU32.lib opengl.lib
c:\lcc\bin\make.exe: Error code 14
c:\lcc\bin\make.exe: ‘triangle.exe’ removed.

I suspect that lcc win32 is not correctly linked to the glfw libraries. Can someone kindly enlighten me on how to get rid of this error? Should I add a path to the autoexec.bat file to make it work?

Thanks.

Hello lightweaver,

I think you have forgotten to link with glfw.lib.

c:\lcc\bin\lcclnk.exe -subsystem console -o c:\glfw\examples\lcc1 riangle.exe triangle.obj GLU32.lib opengl.lib

It should probably be:

c:\lcc\bin\lcclnk.exe -subsystem console -o c:\glfw\examples\lcc1 riangle.exe triangle.obj glfw.lib glu32.lib opengl32.lib gdi32.lib

Every GLFW program needs to be linked with glfw.lib opengl32.lib gdi32.lib (and any other libraries that are used by the program, e.g. glu32.lib, but those are required by GLFW).

Hint 1: check examples\Makefile.lcc in the source code distribution

Hint 2: build the GLFW lib yourself from the source code distribution (just type ‘make win32-lcc’ from the GLFW root directory) - it’s more recent than the binary distribution.

Good luck!