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

Author Topic: Application won't start  (Read 7203 times)

0 Members and 1 Guest are viewing this topic.

sludge

  • Newbie
  • *
  • Posts: 24
    • View Profile
Application won't start
« on: July 04, 2010, 09:50:46 pm »
I am looking through the sfml tutorials right now, but I am having trouble because after compiling the program, it will not run properly.  Visual Studio 2010 tells me that "The application was unable to start correctly(0xc015002).  Note that I am running it through the debugger.

The last line in the debug prompt reads
"'Basebal sim.exe': Loaded 'C:\Users\Nick\Documents\Visual Studio 2010\Projects\Basebal sim\Basebal sim\sfml-window-d.dll', Cannot find or open the PDB file"

I already linked the following three libraries, and their appropriate .dll files are included in the application directory as well.
sfml-system-d.lib
sfml-window-d.lib
sfml-graphics-d.lib

I next tried to use the release version of the libraries instead (but still ran the program through the debugger), and the program started.  Unfortunately, it wasn't long before I received a runtime error,  whose cause I believe resulted from not having included the debug files, at the line sim.Clear();

I'll post my code below:
Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

int main ()
{

sf::RenderWindow sim(sf::VideoMode(800, 600, 32), "Sandlot");

while (sim.IsOpened())
{
//Store any encountered events
sf::Event event;
while (sim.GetEvent(event))
{
//Close program
if (event.Type == sf::Event::Closed)
sim.Close();
}

sim.Clear();

        // Build a custom convex shape
        sf::Shape Polygon;
        Polygon.AddPoint(0, -50,  sf::Color(255, 0, 0),     sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 0,   sf::Color(255, 85, 85),   sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(0, 100,  sf::Color(255, 255, 255), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 0,  sf::Color(255, 85, 85),   sf::Color(0, 128, 128));

        // Define an outline width
        Polygon.SetOutlineWidth(10);

        // Disable filling and enable the outline
        Polygon.EnableFill(false);
        Polygon.EnableOutline(true);

        // Draw it
        sim.Draw(Polygon);

//Display new screen contents
sim.Display();
}


return EXIT_SUCCESS;

}

Does anyone see the problem?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Application won't start
« Reply #1 on: July 04, 2010, 10:31:40 pm »
You need to recompile SFML with Visual C++ 2010.
Laurent Gomila - SFML developer

sludge

  • Newbie
  • *
  • Posts: 24
    • View Profile
Application won't start
« Reply #2 on: July 04, 2010, 10:56:05 pm »
What is involved in compiling sfml?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Application won't start
« Reply #3 on: July 04, 2010, 10:59:07 pm »
Open the VC 2008 solution file (SFML.sln), follow the conversion wizard to convert the projects, select the configuration that you want (debug/release static/DLL), and click "rebuild all".

Apparently the conversion wizard sometimes creates incorrect settings, don't hesitate to look at other similar topics on this forum if you run into troubles :)
Laurent Gomila - SFML developer

sludge

  • Newbie
  • *
  • Posts: 24
    • View Profile
Application won't start
« Reply #4 on: July 05, 2010, 06:33:20 pm »
Thank you.  I got it working.

In case anyone else has a similar problem, this video tutorial here gives a step by step demonstration that shows how to compile SFML in VS2010: