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

Author Topic: SFML Blueprint build problems in C::B  (Read 3253 times)

0 Members and 1 Guest are viewing this topic.

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
SFML Blueprint build problems in C::B
« on: June 09, 2015, 09:50:57 pm »
I bought the book "SFML Blueprint" today and in the book the reader was tasked with compiling SFML 2.2 with CMAKE and to compile the basic "make a circle appear" test program. The code compiles but when the application starts it dies with a "X.exe has stopped working. Windows is looking for a solution" dialog popping up.

CMAKE window

and the files it gave me


I followed the steps and compiled SFML and opened C::B, and followed the steps the book said me to follow.




The code example used is from the book and looks like this:
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main(int argc,char* argv[])
{
    //the window use for the display
    sf::RenderWindow window(sf::VideoMode(400,400),"01_Introduction");
    //set the maximum frame per second
    window.setFramerateLimit(60);

    //construct a circle
    sf::CircleShape circle(150);
    //set his color
    circle.setFillColor(sf::Color::Blue);
    //set his position
    circle.setPosition(10, 20);

    //main loop
    while (window.isOpen())
    {
        //to store the events
        sf::Event event;
        //process events
        while(window.pollEvent(event))
        {
            //Close window
            if (event.type == sf::Event::Closed)
                window.close();
            //keyboard input : Escape is press
            else if (event.type == sf::Event::KeyPressed and event.key.code == sf::Keyboard::Escape)
                window.close();
        }

        //Clear screen
        window.clear();

        //draw the cirle
        window.draw(circle);

        //Update the window
        window.display();

    }

    return 0;
}
 
Anyone has any clue what I might have done wrong? My guess is that I made some error during the CMAKE process, but I have never used CMAKE before so I have no clue what I can try.

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #1 on: June 09, 2015, 10:24:47 pm »
Did you put the .dll files next to your executable?

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #2 on: June 09, 2015, 10:35:25 pm »
Yes, if I didn't I would get another error that say x.dll is missing.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: SFML Blueprint build problems in C::B
« Reply #3 on: June 09, 2015, 10:46:56 pm »
Have you built the example in debug mode, while linking the release libraries?
Is your GPU driver uptodate?

At best you build the debug version of SFML and create a debug version of the example, then run it through GDB and find out where it crashes exactly.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #4 on: June 09, 2015, 10:54:53 pm »
I added output after each line in the code, and it crashed here:
Code: [Select]
sf::RenderWindow window(sf::VideoMode(400,400),"01_Introduction");I have no clue how to build a debug version with the CMAKE, or is that done in the C::B project CMAKE creates for me? I have tried the dll-files in release, and debug. I have my graphics driver up to date.

*EDIT*
I guess I change "Release" in CMAKE to "Debug" so I'll try that.

*EDIT 2*
I guess I built the debug correctly, but I still have the same problem that it crashes on the same line as before.
« Last Edit: June 09, 2015, 11:05:59 pm by Sightburner »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #5 on: June 10, 2015, 10:29:23 am »
Have you tried just debugging in C::B? Set a break point at the start of your main() and then run step by step, if it notices a crash, you should be able to review the values of variables etc. to find out more.

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #6 on: June 10, 2015, 01:22:46 pm »
This is the result from the debug with a breakpoint
« Last Edit: June 10, 2015, 01:30:38 pm by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: SFML Blueprint build problems in C::B
« Reply #7 on: June 10, 2015, 01:32:34 pm »
If it crashes because of strings it's most likely an incompatibility between the runtime libs.
Has SFML been built with the exact same compiler as you're building your application with?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #8 on: June 10, 2015, 01:59:24 pm »
Yes, both are built in C::B 10.05.
And I use the source for SFML 2.2 to build all the SFML stuff.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
AW: SFML Blueprint build problems in C::B
« Reply #9 on: June 10, 2015, 04:44:35 pm »
Any reason for using an outdated Code::Blocks version?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #10 on: June 10, 2015, 10:17:25 pm »
No, I had forgot to update it on my second machine.
I updated to 13.12 and re-compiled SFML and the test project.

One problem I see now is that d:/program/codeblocks doesn't exist. I reinstalled C::B on C:\ but for some reason it is still looking on D:\ I cannot figure out what to try. I did reboot the computer after the installation just in case but the problem is persisting.


« Last Edit: June 10, 2015, 10:38:42 pm by Sightburner »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: SFML Blueprint build problems in C::B
« Reply #11 on: June 10, 2015, 10:30:45 pm »
the test project.
[screenshot]
Is this in debug mode? I ask because "\bin\Release\sfml-system-2.dll" suggests otherwise.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Sightburner

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Blueprint build problems in C::B
« Reply #12 on: June 10, 2015, 10:39:56 pm »
The image is updated, I rebuilt again when I noticed that, and got a new error.
This seem to be C::B related though.