linker - Compiling Glew and SDL in C++ with Code::Blocks -
i've spent last 24 work hours trying compile, using multiple searches , tutorials (some need link dynamically while others need statically), can not work. i'm relatively new compiling , linking appreciated.
here code(as can tell comments tired last night coding this):
#define no_sdl_glext #define glew_static #include "gl/glew.h" #include "sdl/sdl.h" #include "sdl/sdl_opengl.h" int main (int argc, char* args[]){ //loads sdl video module sdl_init(sdl_init_video); //creates sdl surface opengl draw sdl_surface* surface = sdl_setvideomode(800,600,32, sdl_hwsurface | sdl_doublebuf | sdl_opengl ); //sets caption... sdl_wm_setcaption("opengl",0); glewexperimental = gl_true; glewinit(); //main event loop, bread , butter ladies , gentlemen sdl_event windowevent; while (true){ if (sdl_pollevent(&windowevent)){ //if close appplication, causes stop running :d if (windowevent.type == sdl_quit) break; //close esc key! :d:d:d:d:d:d:d:d:d: if (windowevent.type == sdl_keyup && windowevent.key.keysym.sym == sdlk_escape) break; } //literally 1 line of code needed double buffering sdl_gl_swapbuffers(); } //i wish knew ended...lope jk sdl_quit(); return 0; }
and in search directories have:
compiler:
e:\programs\codeblocks\glew-1.10.0\include e:\programs\codeblocks\sdl-1.2.15\include
linker:
e:\programs\codeblocks\glew-1.10.0\lib\release\x64 e:\programs\codeblocks\sdl-1.2.15\lib
and in linker settings have
link libraries:
e:\programs\codeblocks\glew-1.10.0\lib\release\x64\glew32s.lib
other linker options:
-lmingw32 -lglew32s -dglew_static -lsdlmain -lsdl
the error getting is:
in function 'sdl_main': undefined reference `glewexperimental' undefined reference `glewinit@0'
thank in advance help!
you getting linker errors. looks compiling application using mingw compiler. but, sure glew library using built with/for mingw? if didn't build glew , downloaded prebuilt binary, built using visual studio. note not straightforward mix libraries different compilers this.
look @ this: http://www.mingw.org/wiki/msvc_and_mingw_dlls
p.s: unless philosophical reasons against proprietary software preventing doing so, ought consider using visual studio compilers. express editions of visual studio compilers free (beer-like). can use visual studio compiler in great ides qtcreator.
Comments
Post a Comment