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

Author Topic: Problem starting SFML 2.0 with CodeBlocks  (Read 5962 times)

0 Members and 1 Guest are viewing this topic.

killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Problem starting SFML 2.0 with CodeBlocks
« on: January 22, 2013, 09:36:28 am »
When i try to run a program using the sample code in the setup tutorial, the program starts then straight away has an error.
I am using codeblocks with SFML 2.0 made for codeblocks.
The error is the "name.exe has stopped working"
I'm using SFML_STATIC, and i linked the libraries like this in release mode:
sfml-graphics-s
sfml-window-s
sfml-system-s

I copied all the DLLs to the folder.
Here is my main.cpp:

Quote
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}


io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #1 on: January 22, 2013, 11:29:24 am »
This probably won't help, but worth a shot. 

Here is my debug setup (I'm a completely new to SFML, so take the advice with a grain of salt ; ).  I have a little bit different setup then http://www.sfml-dev.org/tutorials/2.0/start-cb.php ...

I think I may have used this tutorial:
http://www.youtube.com/watch?feature=player_embedded&v=LbWavdiod1Q#!
He covers both dynamic and static links.  Static links start around 6.30



Don't forget your #define SFML_STATIC
This is on the *very* top one -- that is I clicked SFML_Proj1 and wen to the appropriate section




Here are my two relevant settings on the debug sub section




killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #2 on: January 22, 2013, 12:14:13 pm »
where can you find the project/targets options? :P

io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #3 on: January 22, 2013, 12:17:35 pm »
Oh woops -- that was a different section that I forgot to label.

Project->Properties->C/C++ Parser Options

killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #4 on: January 22, 2013, 12:53:34 pm »
Thankyou for the help, unfortunatly, i still get the same error.
It compiles properly, but as soon as the program starts, it has an error. If i remove all the SFML coding from main.cpp and make a program that doesn't use SFML, it doesn't crash.

io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #5 on: January 22, 2013, 01:02:37 pm »
I'm guessing you DL'ed / and have latest version of CodeBlocks/mingw and the right sfml zip
http://www.sfml-dev.org/download/2.0-rc/SFML-2.0-rc-windows-32-gcc4-sjlj.zip

Sorry I wasn't much help -- hopefully someone else will have the solution :}.

I get those crashes a lot of times from pointer stuff, but your basic program shouldn't be doing that o_o.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #6 on: January 22, 2013, 01:04:26 pm »
What's your exact version of GCC?
 Because if it's >= 4.7.x then you'll have to recompile SFML on your own (or use my nightly builds).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #7 on: January 22, 2013, 01:09:34 pm »
Not sure, i just downloaded the latest version of codeblocks today on their website, i guess i got a too new verson then? :)

Thanks for the help, can you link me to your nightly builds please :D

io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #8 on: January 22, 2013, 01:14:13 pm »
Oh wow.. I didn't realize Code:Blocks was up to v 12 now o_o.


I think you'll find your GCC version:

C:\Program Files (x86)\CodeBlocks\MinGW

should be a changelog file.

killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #9 on: January 22, 2013, 01:16:52 pm »
'GCC 4.6 & 4.7 Series'

Yeah ok, i need the nightly builds :)

io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #10 on: January 22, 2013, 01:20:21 pm »

killerloader

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #11 on: January 22, 2013, 01:26:51 pm »
i downloaded 'MinGW TDM GCC 4.7.1 32bit'
But it still crashed o.o
[EDIT]

Nethermind, i forgot to rebuild... :3 it works thankyou :)
« Last Edit: January 22, 2013, 01:28:24 pm by killerloader »

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem starting SFML 2.0 with CodeBlocks
« Reply #12 on: January 29, 2013, 06:30:40 am »
I had a similar runtime crash problem and using that same nightly build fixed it too :)
Blokade: Source

 

anything