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

Author Topic: Crash at app run  (Read 7002 times)

0 Members and 1 Guest are viewing this topic.

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« on: October 12, 2010, 05:34:34 am »
Every time I run an app with SFML it crashes with an error message similar to the following:



This happens with any app that involves SFML, regardless of the content. Even the sample time test code crashes with this error.

I am running Visual Studio 2010. My friend compiled the latest version of SFML in VS2010 for me. Even then I continue to get the error. My friend, using the exact same code, and the exact same library files, compiles and runs just fine.

My compiler settings (linkers, includes, etc) are all correct.

I am attempting to use the dynamic, debug versions of the libraries.

I am on Windows 7 Ultimate 64-bit.

AdrianC

  • Newbie
  • *
  • Posts: 5
    • MSN Messenger - comiseladrian@yahoo.com
    • AOL Instant Messenger - 2914+Trelle+Way+
    • View Profile
Crash at app run
« Reply #1 on: October 12, 2010, 05:50:25 pm »
Maybe try running the code from one of the tutorials?

Here's the code from the first tut.
Code: [Select]

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


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // A key has been pressed
            if (Event.Type == sf::Event::KeyPressed)
            {
                // Escape key : exit
                if (Event.Key.Code == sf::Key::Escape)
                    App.Close();

                // F1 key : capture a screenshot
                if (Event.Key.Code == sf::Key::F1)
                {
                    sf::Image Screen = App.Capture();
                    Screen.SaveToFile("screenshot.jpg");
                }
            }
        }

        // Clear the screen with red color
        App.Clear(sf::Color(200, 0, 0));

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


I'm new to SFML so maybe I'm missing something, but in your code I noticed you used sf::window App(...); Shouldn't it be sf::RenderWindow App(...) ?

Also not sure what the WINAPI WinMain (...) stuff is, but as I said I'm a very new to SFML and programming.

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« Reply #2 on: October 12, 2010, 06:56:46 pm »
I have no idea where your getting your tutorials. I got my code from this one here: http://www.sfml-dev.org/tutorials/1.6/window-window.php

It compiles just fine, only throwing the error when run, which probably points to a problem outside the code itself, in the compiler or runtime environment of some sort.

I tried your code, and it doesn't even compile. It throws a linker error ( 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup )

EDIT: My friend just tried what may be one of his last ideas. He set up the first tutorial's code here: http://www.sfml-dev.org/tutorials/1.6/start-vc.php in a VS2010 project, and included the SFML files in the project itself. He zipped it and place it here: http://www.mediafire.com/?0p9aawl9lpxy1fu Totally setup to compile with no problems, it compiles on his end just fine (and should on anyone else's with VS2010. On my end I get the same error: http://img833.imageshack.us/img833/3578/nopedotavi.png

I am stumped. Anyone got any ideas?

AdrianC

  • Newbie
  • *
  • Posts: 5
    • MSN Messenger - comiseladrian@yahoo.com
    • AOL Instant Messenger - 2914+Trelle+Way+
    • View Profile
Crash at app run
« Reply #3 on: October 12, 2010, 08:44:09 pm »
The code I posted is from the first graphics tutorial. I guess its not technically the first tut.

Anyway, I'm guessing you have some linking problems. That was what I struggled with at first. (I was also getting unresolved external)

I'll just go through the linking steps again. I have vs 2008, but it should work in the same way in vs 2010.

Go to View/ "Your Project Name" Properties. (You can also press ALT + f7 in vs2008).

Go to
Configuration Properties
C/C++
Preprocessor
Add SFML_DYNAMIC to the end of "Preprocessor Definitions"

Go to
Configuration Properties
Linker
Input
Add "sfml-window-d.lib sfml-graphics-d.lib sfml-system-d.lib" into "Additional dependencies".


Make sure you have all the required .dll files in your project folder.

That should be it. I assumed you already added the folder locations for for Visual C++ to find. (I'm referring to the first part of this tutorial: http://www.sfml-dev.org/tutorials/1.6/start-vc.php )

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« Reply #4 on: October 12, 2010, 10:47:30 pm »
Thats not the problem. We already worked through that. Like 5-6 times already. All of that is 100% correct.

AdrianC

  • Newbie
  • *
  • Posts: 5
    • MSN Messenger - comiseladrian@yahoo.com
    • AOL Instant Messenger - 2914+Trelle+Way+
    • View Profile
Crash at app run
« Reply #5 on: October 12, 2010, 10:56:27 pm »
Not sure what to say then, it should work.

I would create another project, enter all the linker settings and try again. If that still doesn't work, I would download vs 2008, and try using the precompiled version of SFML.

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« Reply #6 on: October 12, 2010, 11:15:29 pm »
Quote from: "AdrianC"
I would create another project, enter all the linker settings and try again.


Nope. Still doesn't work.

Quote from: "AdrianC"
If that still doesn't work, I would download vs 2008, and try using the precompiled version of SFML.


Thats not a solution at all, thats surrender. I will never surrender, I will solve this problem!  :lol:

Thanks for your help though. I really appreciate it.

Anyone else want to take a crack at the problem?

PeterWelzien

  • Newbie
  • *
  • Posts: 38
    • View Profile
Crash at app run
« Reply #7 on: October 13, 2010, 07:33:29 am »
Have you tried using the same project file as your friend?
/Peter Welzien

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« Reply #8 on: October 13, 2010, 12:18:33 pm »
Yep. Thats exactly what we tried last.

PeterWelzien

  • Newbie
  • *
  • Posts: 38
    • View Profile
Crash at app run
« Reply #9 on: October 13, 2010, 12:21:58 pm »
Have you checked that you're using the correct DDL files?
/Peter Welzien

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Crash at app run
« Reply #10 on: October 13, 2010, 01:35:12 pm »
At what point? When I copy them over to the project files?

I don't actually have any other versions on my machine. I deleted all the other ones to be sure. However, it is possible that the ones I have are wrong.

How do I check them to see if they are correct?

PeterWelzien

  • Newbie
  • *
  • Posts: 38
    • View Profile
Crash at app run
« Reply #11 on: October 13, 2010, 08:18:48 pm »
If you copied them from your friend they're probably correct.
/Peter Welzien

unzzi

  • Newbie
  • *
  • Posts: 2
    • View Profile
Crash at app run
« Reply #12 on: October 16, 2010, 11:41:50 pm »
Having the exact same problem. Maybe it's a 64-bit problem? Also running windows 7 64-bit.

PeterWelzien

  • Newbie
  • *
  • Posts: 38
    • View Profile
Crash at app run
« Reply #13 on: October 17, 2010, 11:17:22 am »
I don't think it's a 64-bit problem. I'm running Win7 64 bit and VS2010 and I use SFML2 without a problem. I had no trouble building the libs myself. I just loaded the VS2008 solution, converted it and selected batch build.
/Peter Welzien

unzzi

  • Newbie
  • *
  • Posts: 2
    • View Profile
Crash at app run
« Reply #14 on: October 17, 2010, 10:42:48 pm »
My problem was with SFML 1.6 but I'll try with 2.0 and see how that goes.

edit: SFML 2 seems to work.