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

Author Topic: Trouble at Runtime  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

RedTheGreen

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • RedTheGreen's Website
    • Email
Trouble at Runtime
« on: December 23, 2012, 09:42:53 pm »
Hi. I've followed your tutorial for SFML-2.0 RC with Code::Blocks. I get this segmentation fault:
#0 6E182B85     sf::VideoMode::VideoMode(this=0xc8, modeWidth=200, modeHeight=32, modeBitsPerPixel=2) (D:\developpement\sfml-master\src\SFML\Window\VideoMode.cpp:50)
#1 00401418     main(argc=1, argv=0x372d80) (C:\Users\Nicolas\Documents\Projects\Fox 3\main.cpp:5)
 

I found that this issue was already reported here (http://en.sfml-dev.org/forums/index.php?topic=9598.0) with no answer. Does anybody have any idea on how to fix this?

I'm on an AMD Radeon HD 6850 if that helps.
« Last Edit: December 23, 2012, 10:49:46 pm by RedTheGreen »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble with Runtime
« Reply #1 on: December 23, 2012, 10:08:34 pm »
Since you didn't provide any code (like you should) I can only guess from the error message, that you called sf::VideoMode wrongly, because afaik BitsPerPixel can not be 2, but the error messages says modeBitsPerPixel=2.
The usual way to create a window is the following:
sf::RenderWindow window(sf::VideoMode(200, 200), "Hello World!");

Also I'm not sure what you wanted to say with 'with Runtime'... Did you mean 'at runtime' or 'with the runtime library'?
For the second one I wouldn't know how you'd have gotten the impression that has to do with the runtime library. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

RedTheGreen

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • RedTheGreen's Website
    • Email
Re: Trouble at Runtime
« Reply #2 on: December 23, 2012, 10:49:31 pm »
I was following the tutorial, like I said, which is why I didn't provide code.

copied/pasted from the tutorial page:

#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;
}

Sorry about the confusion.

EDIT: I just found something interesting. The documentation states that there are only three arguments (width, height, bpp) for VideoMode, but when I do
sf::VideoMode(200,200,32)
it comes up with
#0 6E182B85     sf::VideoMode::VideoMode(this=0xc8, modeWidth=200, modeHeight=32, modeBitsPerPixel=2)

The "this=0xc8" part worries me.
« Last Edit: December 23, 2012, 10:55:39 pm by RedTheGreen »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble at Runtime
« Reply #3 on: December 23, 2012, 10:53:52 pm »
Which version does your GCC have?
You might need to recompile SFML if you have a version >= 4.7.x
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

RedTheGreen

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • RedTheGreen's Website
    • Email
Re: Trouble at Runtime
« Reply #4 on: December 23, 2012, 10:57:21 pm »
Hmm. I have 4.7.1. I'll recompile it. Strange, this is the version that came with the newest version of Code::Blocks. Maybe you should update your CB download to support this.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Trouble at Runtime
« Reply #5 on: December 23, 2012, 11:03:09 pm »
It's not strange at all, the SFML 2 RC was released before the newest version of Code::Blocks came out. One could think about recompiling things, but since it's only a RC and the current Git version is already quite a bit better, it doesn't make much sense to compile old and not yet final code with new compilers and thus the job is rather left with the user.

I'm providing some Nightly Builds for a few different compiler versions. (Also I'm just a forum user like anyone else, so I can't do anything about the website...) ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

RedTheGreen

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • RedTheGreen's Website
    • Email
Re: Trouble at Runtime
« Reply #6 on: December 23, 2012, 11:04:08 pm »
I forgot that it's still just an RC.

EDIT: I got it to work with the latest nightly build under GCC 4.7.1. Thank you for the link.
« Last Edit: December 23, 2012, 11:06:54 pm by RedTheGreen »

 

anything