opengl - Linking GLFW in CodeBlocks -



opengl - Linking GLFW in CodeBlocks -

codeblocks' glfw project outdated , works glfw 2.7. using latest version, 3.0.4, , trying link in codeblocks statically (i hope using right terminology). happy if told me how step step. create empty project if possible , manually.

this code trying run:

#include <glfw/glfw3.h> int main(void) { glfwwindow* window; /* initialize library */ if (!glfwinit()) homecoming -1; /* create windowed mode window , opengl context */ window = glfwcreatewindow(640, 480, "hello world", null, null); if (!window) { glfwterminate(); homecoming -1; } /* create window's context current */ glfwmakecontextcurrent(window); /* loop until user closes window */ while (!glfwwindowshouldclose(window)) { /* render here */ /* swap front end , buffers */ glfwswapbuffers(window); /* poll , process events */ glfwpollevents(); } glfwterminate(); homecoming 0; }

this have in "other linker options": -lmingw32 -lopengl32 -lgdi32 , copied glfw folder containing header files in codeblocks/mingw/include.

this pretty much did , next build log:

-------------- build: debug in initializing opengl (compiler: gnu gcc compiler)--------------- mingw32-g++.exe -o "bin\debug\initializing opengl.exe" obj\debug\main.o -lmingw32 -lopengl32 -lgdi32 obj\debug\main.o: in function `main': d:/development/opengl/initializing opengl/main.cpp:8: undefined reference `glfwinit' d:/development/opengl/initializing opengl/main.cpp:12: undefined reference `glfwcreatewindow' d:/development/opengl/initializing opengl/main.cpp:15: undefined reference `glfwterminate' d:/development/opengl/initializing opengl/main.cpp:20: undefined reference `glfwmakecontextcurrent' d:/development/opengl/initializing opengl/main.cpp:28: undefined reference `glfwswapbuffers' d:/development/opengl/initializing opengl/main.cpp:31: undefined reference `glfwpollevents' d:/development/opengl/initializing opengl/main.cpp:23: undefined reference `glfwwindowshouldclose' d:/development/opengl/initializing opengl/main.cpp:34: undefined reference `glfwterminate' collect2.exe: error: ld returned 1 exit status

jigger project config mingw invocation looks this:

x86_64-w64-mingw32-g++.exe -llib -o bin\debug\glfw-proj.exe obj\debug\main.o -lglfw3 -lopengl32 -lgdi32

note -lglfw3.

procedure:

project -> build options... select top-level configuration (i.e., not debug or release) in search directories -> compiler tab add together path glfw headers (glfw/glfw3.h , friend) in search directories -> linker tab add together path glfw library files (libglfw3.a , friends) in linker settings tab add together 3 link libraries: glfw3, opengl32, , gdi32.

opengl codeblocks glfw

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -