c++ - SFML 2.1 program runs fine in debug mode, but crashes in release mode -


i using qt creator sfml project. problem experiencing application crash on line of code only if running in release mode.

i've stripped down application find exact line of code causing problem. here entire program looks like:

works in debug mode; crashes in release mode

#include <sfml/graphics.hpp>  int main() {     sf::renderwindow window(sf::videomode(800, 600), "sfml worked!");     window.setverticalsyncenabled(true);      sf::shader shader;     shader.loadfromfile("data\\shaders\\horizontalblur.frag", sf::shader::fragment);      return 0; } 

if remove loadfromfile code, run fine in both debug , release modes.

works in debug mode; works in release mode

#include <sfml/graphics.hpp>  int main() {     sf::renderwindow window(sf::videomode(800, 600), "sfml worked!");     window.setverticalsyncenabled(true);      sf::shader shader;     //shader.loadfromfile("data\\shaders\\horizontalblur.frag", sf::shader::fragment);      return 0; } 

my system looks this:

  • windows 8 64-bit
  • qt creator 2.8.1
  • gcc 4.8
  • sfml 2.1 compiled gcc 4.8

i'm looking suggestions , guidance me figure out cause line of code work in debug mode, not in release mode.

thank you! :)

update #1

i using qmake project. creates 3 make files:

  • makefile
  • makefile.debug
  • makefile.release

i'm not experienced makefiles, can see information libraries being linked in debug , release make files.

makefile.debug

libs        =        c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-main-d.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-graphics-d.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-window-d.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-system-d.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-audio-d.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-network-d.a  

makefile.release

libs        =        c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-main.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-graphics.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-window.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-system.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-audio.a c:/users/derek/documents/development/projects/dots-a-lot/dependencies/sfml-2.1-windows-gcc-4.8-mingw-32bits/lib/libsfml-network.a  

i have debug dlls in debug output folder (next debug executable) , release dlls in release output folder (next release executable). data folder in both debug , release folders has access fragment shader file.

i able solve problem. had followed these instructions build sfml:

http://sfml-dev.org/tutorials/2.1/compile-with-cmake.php

i had downloaded g++ 4.8.1 mingw , used compile sfml. however, when used .a/.dll files produced build, release build crash on line of code.

today (10-7-2013) found these instructions:

https://github.com/laurentgomila/sfml/wiki/tutorial%3a-compile-and-link-sfml-with-qt-creator#step-10

i ran through instructions , used g++ 4.8.0 compiler came qt creator (instead of 1 had downloaded). able run in release mode without crashing.

i didn't realize using 1 version of compiler build sfml (g++ 4.8.1) , build application (g++ 4.8.0).

thank you, luiscubal, pointing me in right direction asking me questions linker. :)


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -