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

Author Topic: libstdc++6.dll error - unable to run tutorial test program  (Read 4042 times)

0 Members and 1 Guest are viewing this topic.

Enum

  • Newbie
  • *
  • Posts: 2
    • View Profile
libstdc++6.dll error - unable to run tutorial test program
« on: December 14, 2016, 11:51:59 pm »
(click to show/hide)

I'm using Code::Blocks and the GCC/G++ MinGW compiler. Code::Blocks version 16.01.

It compiles successfully, but when I run it, I get an error message about libstdc++6.dll. I've copied all of the SFML dlls and the file I talked about above to my project's executable directory, but get this error. What should I do?

EDIT: I'm using Windows 7: Home Premium
« Last Edit: December 14, 2016, 11:55:25 pm by Enum »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
libstdc++6.dll error - unable to run tutorial test program
« Reply #1 on: December 15, 2016, 11:07:56 am »
And where did you get the libstdc++ DLL from? What SFML package did you download?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Enum

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: libstdc++6.dll error - unable to run tutorial test program
« Reply #2 on: December 16, 2016, 05:03:31 am »
And where did you get the libstdc++ DLL from? What SFML package did you download?

I got it and MinGW with the code::blocks 16.01 IDE zip package. As for the SFML package: GCC 6.1.0 MinGW (DW2) - 32-bit.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: libstdc++6.dll error - unable to run tutorial test program
« Reply #3 on: December 16, 2016, 10:25:49 am »
And when you downloaded Code::Blocks what did it say which version of MinGW it shipped? Hint: 6.1.0 is not it.

Quote from: Code::Blocks download page
the GCC/G++ compiler and GDB debugger from TDM-GCC (version 4.9.2, 32 bit, SJLJ).

Also note:
Quote from: SFML download page
The compiler versions have to match 100%! Here are links to the specific MinGW compiler versions used to build the provided packages
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

jamesL

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: libstdc++6.dll error - unable to run tutorial test program
« Reply #4 on: December 16, 2016, 06:56:06 pm »
go here
http://www.codeblocks.org/downloads/binaries

download this
codeblocks-16.01mingw-nosetup.zip

put it in a folder
C:\New_folder\codeblocks-16.01mingw-nosetup.zip

unzip it
C:\New_folder\codeblocks-16.01mingw-nosetup

go here
http://www.sfml-dev.org/download/sfml/2.4.1/

download this
GCC 4.9.2 TDM (SJLJ) - 32-bit

put it in a folder
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit.zip

unzip it
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit

go to your codeblocks folder
C:\New_folder\codeblocks-16.01mingw-nosetup

run
CbLauncher.exe

it will ask you which compiler you want to use
it will tell you it has detected
GNU GCC Compiler

select and highlight that compiler and click the
Set as Default
button

then click
OK

now it may ask you if you want to set codeblocks as the default application for C and C++ files
choose any option you want - it does not matter
if it doesn't ask, that's ok

click the OK button

click the
Create a new project
option

a window will pop up with Project templates

scroll down and find
SFML project

select it and press Go

it will say
"Welcome to the SFML project wizard"

Click Next >

it will give you a choice for SFML 1.6 and SFML 2.0

make sure 2.0 is highlighted
press Next >

It will ask you which type of library to add

Choose Dynamic Link Library
press Next >

Project title = project_1
Folder to create project in = C:\New_folder\
press Next >

A window pops up asking you to select the location of SFML on your computer
it says
$(#sfml)
change it to
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1

press Next >

a window pops up asking you about Debug and Release
leave as is
press Finish

A project and C++ file have been created for you

go to the codeblocks menu and press
Build
then
Build

Your program should build with no errors
you will not be able to run your program yet.

first go to
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1\bin
copy all the files in ^ this folder

and paste them here (this is a copy, not a move)
C:\New_folder\project_1\bin\Debug

go to the codeblocks menu and press
Build
then
Run

this builds a 32 bit executable

going into the Project / Build options and selecting
c++11
or
c++14
will make no difference

this should be enough to get you started

however, you will eventually run into problems with this 

as far as I can tell this version of the compiler leaves out some C++ functions that you might find in some SFML examples

specifically the
to_string
function 

it was broken in MinGW and eventually fioxed in MinGW-w64
as detailed here
http://stackoverflow.com/questions/12975341/to-string-is-not-a-member-of-std-says-g

you can eventually install a correct compiler and corresponding SFML version from the SFML download page

but this should be enough to get you started

oh, if you add
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1\bin
to your PATH
or copy the dlls to a folder already in your PATH then you won't have to copy them all the time