c - Compile GLFW cannot find -lglfw3 -


i want learn opengl programming glfw library. have problem when compiling program. followed tutorial on http://www.glfw.org/docs/latest/quick.html , copied full program. download 64-bit version library on http://www.glfw.org/download.html.

i changed first line include <glfw/glfw3.h> include "glfw/glfw3.h". i've put glfw folder inside folder along glfw3.dll, glfw3dll, , libglfw3.a

i'm running on windows 7. gcc version

gcc --version gcc (tdm64-1) 5.1.0 

i use command compiling

gcc test.c -llib-mingw/ -lglfw3 -lopengl32 -lgdi32 

but got error

cannot find -lglfw3 

what should make work?

if still having problems compilation/linking problem, try set glfw full lib folder path in gcc or g++ lib path -l parameter, simplified below. double quotes , non-relative paths should work.

g++ "-l<path_to_glfw>\\glfw\\lib-mingw" -o <executable>.exe <.o files list> -lopengl32 -lglfw3 -lgdi32  

two notes:

  1. there no need pass .a extension. mingw g++/gcc compiler automatically understand filename.
  2. if using 64-bit version of glfw, switch -l parameter \glfw\lib-mingw64 (or respective 64-bit library location folder)

Comments