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

Author Topic: First project  (Read 3808 times)

0 Members and 1 Guest are viewing this topic.

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« on: February 05, 2010, 03:39:12 am »
I'm creating a project for school using SFML. I moved all the necessary files for SFML. Modified the project settings and everything. I followed the tutorial. The code compiles but nothing is happening even when I try to just do a simple cout. I'm using Visual Studios C++ 2008. Any ideas as to why it's not working right would greatly help.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
First project
« Reply #1 on: February 05, 2010, 03:41:12 am »
Please show the source code you are using so that we can find the source of the problem.
I use the latest build of SFML2

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #2 on: February 05, 2010, 03:26:01 pm »
Code: [Select]
#include "stdafx.h"
#include <SFML/System.hpp>
#include <iostream>

int main()
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }

    return 0;
}

Its from the tutorial

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
First project
« Reply #3 on: February 05, 2010, 03:43:34 pm »
Are you sure that your project is a "console application", not a "Win32 application"?
Laurent Gomila - SFML developer

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #4 on: February 05, 2010, 03:54:32 pm »
The only console apps are Win32 console app and CLR console app for c++

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
First project
« Reply #5 on: February 05, 2010, 04:01:06 pm »
Yes, it should be "Win32 console app". You can also set it in the project settings, under linker --> System --> SubSystem.
Laurent Gomila - SFML developer

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #6 on: February 05, 2010, 04:03:58 pm »
Ok. I've been using Win32 Console App. I checked the subsystem and its Console

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
First project
« Reply #7 on: February 05, 2010, 04:07:10 pm »
Can you see the console when you launch your application? If you put a breakpoint on the "return 0" line and run the debugger (F5), is it hit?
Laurent Gomila - SFML developer

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #8 on: February 05, 2010, 04:12:43 pm »
The console shows up and says "Press any key to continue..." Here's what shows up when I put in the breakpoint:
Code: [Select]
'regf.exe': Loaded 'C:\Documents and Settings\Sonya G. Aguilar\My Documents\Visual Studio 2008\Projects\regf\Debug\regf.exe', Symbols loaded.
'regf.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\EntAPI.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\psapi.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll'
'regf.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'regf.exe': Unloaded 'C:\WINDOWS\system32\EntAPI.dll'
'regf.exe': Unloaded 'C:\WINDOWS\system32\netapi32.dll'
'regf.exe': Unloaded 'C:\WINDOWS\system32\psapi.dll'
'regf.exe': Unloaded 'C:\WINDOWS\system32\msvcrt.dll'
Debugger:: An unhandled non-continuable STATUS_DLL_NOT_FOUND exception was thrown during process load
The program '[2820] regf.exe: Native' has exited with code -1073741515 (0xc0000135).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
First project
« Reply #9 on: February 05, 2010, 04:16:32 pm »
Quote
An unhandled non-continuable STATUS_DLL_NOT_FOUND exception was thrown during process load

It seems that a DLL is not found, maybe sfml-system.dll? It's weird that you never got an error dialog box from the OS, if it's really that.
Laurent Gomila - SFML developer

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #10 on: February 05, 2010, 04:33:05 pm »
Wow. I put the dll's in the wrong folder. Thanks. I got a new problem though. When I display a window, there's a bunch of black spots in the window. Any ideas why. Here's the code:
Code: [Select]
#include "stdafx.h"
#include <SFML/Window.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 16), "SFML Events");

    // Get a reference to the input manager associated to our window, and store it for later use
    const sf::Input& Input = App.GetInput();

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

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Get some useless input states, just to illustrate the tutorial
        bool         LeftKeyDown     = Input.IsKeyDown(sf::Key::Left);
        bool         RightButtonDown = Input.IsMouseButtonDown(sf::Mouse::Right);
        bool         JoyButton1Down  = Input.IsJoystickButtonDown(0, 1);
        unsigned int MouseX          = Input.GetMouseX();
        unsigned int MouseY          = Input.GetMouseY();

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

    return EXIT_SUCCESS;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
First project
« Reply #11 on: February 05, 2010, 04:36:03 pm »
That's because you don't draw anything into the window, so the you always see the initial garbage (what was in video memory when you started your app).
Laurent Gomila - SFML developer

arcticstrat

  • Newbie
  • *
  • Posts: 10
    • View Profile
First project
« Reply #12 on: February 05, 2010, 04:48:07 pm »
I think I got everything down now. Thanks a lot Laurent