Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error when I try to execute my game  (Read 4146 times)

0 Members and 1 Guest are viewing this topic.

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Error when I try to execute my game
« on: August 26, 2015, 05:32:15 pm »
So whenever I try to run the .exe of my game this happens:

How can I fix that? do I need to reinstall that libstdc++-6.dll or something?

jamesL

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: Error when I try to execute my game
« Reply #1 on: August 26, 2015, 06:17:54 pm »
what compiler did you use
what libraries are you using

I think I got something like when I first tried to use Thor
I think I downloaded the precompiled binaries, but it didn't work with the standard codeblocks+mingw

so I ended up having to download cmake and learn how to use it and compile it myself

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #2 on: August 26, 2015, 08:29:22 pm »
Compiler: MinGW GCC 4.8.1 (I think)
What do you mean by libraries ?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Error when I try to execute my game
« Reply #3 on: August 26, 2015, 08:42:48 pm »
What do you mean by libraries ?
The ones you're linking. You have to make sure SFML was compiled with the same standard library and the same compiler flags as your application.

If you don't know this term, you should probably spend a bit more time with C++ and compiler/linker basics before starting with SFML :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #4 on: August 26, 2015, 08:54:23 pm »
What do you mean by libraries ?
The ones you're linking. You have to make sure SFML was compiled with the same standard library and the same compiler flags as your application.
And, most importantly, the exact same compiler (and version of that compiler) - which is why it's usually a good idea to just compile SFML from source yourself rather than use pre-compiled binaries.

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #5 on: August 27, 2015, 05:11:21 am »
The ones you're linking. You have to make sure SFML was compiled with the same standard library and the same compiler flags as your application.

If you don't know this term, you should probably spend a bit more time with C++ and compiler/linker basics before starting with SFML :)
Maybe this:(?)

I think I did that part correctly as I don't get any linker errors...

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Error when I try to execute my game
« Reply #6 on: August 27, 2015, 08:26:06 am »
Actually, no you didn't. Graphics goes first, then window then system. Also suffixes matter.

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #7 on: August 27, 2015, 08:49:30 am »
Ok, so this is what I did now:

Then in the Release part:

Also, I was unsure of my MinGW GCC compiler version so I went to the command line and typed g++ --version, apparently my version now is 4.9.2 o.O

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Error when I try to execute my game
« Reply #8 on: August 27, 2015, 09:22:31 am »
Okay, take all the current ones you have in Test, out and put them in Debug, then put -s-d after all the SFML ones.

jamesL

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: Error when I try to execute my game
« Reply #9 on: August 27, 2015, 11:43:06 am »
this is how I got sfml and codeblocks on windows running

downloaded codeblocks
codeblocks-13.12mingw-setup.exe
from
http://www.codeblocks.org/downloads/binaries 

downloaded SFML
GCC 4.7.1 TDM (SJLJ) - 32-bit
from
http://www.sfml-dev.org/download/sfml/2.3.1/

(the file is named
SFML-2.3.1-windows-gcc-4.7.1-tdm-32-bit.zip)

extract
SFML-2.3.1
from
the zip file

build a blank console project in codeblocks
and put this in your .cpp file
#include <SFML/Graphics.hpp>

then go to the codeblocks menu and select
Project / Build options ...

then choose the project name (not debug or release)

choose the tab named
Search Diriectories

then the tab named
Compiler
and set it to the location of the SFML include (mine looks like this)
D:\Programs\code_blocks_dev_lib\SFML\SFML-2.3.1\include

http://i.imgur.com/BagigTP.png

now click the tab named
Linker
and set it to the location of the SFML lib (mine looks like this)
D:\Programs\code_blocks_dev_lib\SFML\SFML-2.3.1\lib

http://i.imgur.com/8d5yQwz.png

now select the Debug version
and the tab named
Linker Settings
and add
sfml-graphics-d
sfml-window-d
sfml-system-d

http://i.imgur.com/ZhDfDcO.png

this is not staticly linked
so you will have to copy the dlls from
D:\Programs\code_blocks_dev_lib\SFML\SFML-2.3.1\bin

into your debug folder

installing sfml and getting it running was very easy

and actually, once you extract SFML-2.3.1
you can just go to codeblocks and select an sfml project template
and when it asks for the location of sfml just give it
D:\Programs\code_blocks_dev_lib\SFML\SFML-2.3.1\

then select version 2 of sfml and it sets everything up for you

very nice

« Last Edit: August 27, 2015, 11:48:25 am by jamesL »

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #10 on: August 27, 2015, 12:28:09 pm »
Okay, take all the current ones you have in Test, out and put them in Debug, then put -s-d after all the SFML ones.
Ok, so I removed everything in Test then did that, no linker errors. But the same problem remains :(

@jamesL I'm gonna try that, maybe it'll work...

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Error when I try to execute my game
« Reply #11 on: August 28, 2015, 11:45:42 am »
You mots likely have another version of that library in your path.

Copy the one from your GCC's bin dir next to the compiled executable.

louie

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Error when I try to execute my game
« Reply #12 on: August 28, 2015, 05:26:16 pm »
I tried to build SFML with cmake-gui, the build was successful but when I tried to make a simple test game to know if it works I get this error:
||=== Build: Debug in test (compiler: GNU GCC Compiler) ===|
C:\SFML\lib\libsfml-graphics-s-d.a(ImageLoader.cpp.obj)||In function `ZN2sf4priv11ImageLoader8writeJpgERKSsRKSt6vectorIhSaIhEEjj':|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|277|undefined reference to `jpeg_std_error'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|280|undefined reference to `jpeg_CreateCompress'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|285|undefined reference to `jpeg_stdio_dest'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|286|undefined reference to `jpeg_set_defaults'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|287|undefined reference to `jpeg_set_quality'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|300|undefined reference to `jpeg_start_compress'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|306|undefined reference to `jpeg_write_scanlines'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|310|undefined reference to `jpeg_finish_compress'|
C:\SFMLBUILD\src\SFML\Graphics\ImageLoader.cpp|311|undefined reference to `jpeg_destroy_compress'|
||=== Build failed: 9 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
 
Here is my linker settings:

I don't know what I did wrong for those errors to come up :(
>>>>>>>>>>>>>>>EDIT<<<<<<<<<<<<<<<<<<<<<<<
@Mario OMG it worked! I copied the libstd thing from the mingw bin to my System32 folder(it replaced the one that was there) and now it works :))))))
« Last Edit: August 28, 2015, 05:31:59 pm by louie »