SFML community forums
Help => General => Topic started by: con on February 06, 2014, 08:43:37 pm
-
Hi all, I have managed to setup a SFML application with opengl and glew and all working fine. One thing though is very odd.
This makes the application work fine.
GLenum glewStatus = glewInit();
But this however makes the application crash.
glewInit();
Currently I am using QT Creator with mingw on windows, I think I remember by using codeblocks (couple of weeks ago) that there was not such problem.
Any ideas about what it is?
-
Whether you store the return value or not really shouldn't make a difference. It certainly shouldn't cause a crash.
Are you sure you are linking with the correct debug/release versions of libraries?
Does it make a difference if you build with/without optimizations?
Have you tried running the programme in a debugger? What does it say about where/why it crashes?
-
Happened to me to. And what I did was to download the latest version from the official site and compile it manually using the same compiler I use for SFML. I build it as a static library and made sure to define GLEW_STATIC in both the Glew project and the projects where I link to Glew. I replaced the the default libglew.a from the extlibs directory of SFML and compiled SFML again. When I linked the libraries to my project I made sure I first link to SFML's libraries and then the Glew library. Then I compiled my project again and voila, it worked :) NOTE: I was using Code::Blocks and MinGW GCC 4.8.1 and SFML was built as static. Building it as static decreased my total executable size :) If you build SFML as static, make sure to add the following libraries on your project (-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32) So that you won't get "Undefined reference.." But before you do all that make sure you have GLEW_STATIC in your project if the Glew library that you use is a static library and check to see if that helps or SFML_STATIC if you have static SFML libraries.
-
Thanks for the suggestions I will try them again to see how it goes. ;)