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

Author Topic: Need help with tutorial  (Read 1647 times)

0 Members and 1 Guest are viewing this topic.

Shriek

  • Newbie
  • *
  • Posts: 4
    • View Profile
Need help with tutorial
« on: July 08, 2011, 01:14:12 pm »
Hi guys I've gone through the tutorial "Graphics - Using render windows" and I tried to make one but it won't work, I get 9 errors all saying parts of code are referenced in function_main, here is the code:

Code: [Select]

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

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();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

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

    return EXIT_SUCCESS;
}


It's just a copy paste from the tutorial except the #includes and I have linked the sfml-system.lib.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Need help with tutorial
« Reply #1 on: July 08, 2011, 01:17:13 pm »
Did you also read this tutorial: http://www.sfml-dev.org/tutorials/1.6/start-vc.php

Because of you did then you would know that you have to also link against sfml-window.lib and sfml-graphics.lib
Also that you have to link against the debug libraries(-d.lib) if you are compiling a debug exe.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Shriek

  • Newbie
  • *
  • Posts: 4
    • View Profile
Need help with tutorial
« Reply #2 on: July 08, 2011, 02:10:13 pm »
Thanks, but now there's another problem :/. I have included the additional .lib files and it worked but it crashes, so I included the -d.lib files aswell and that didn't help. I get this message when it crashes:

A buffer overrun has occurred in Project3.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

Never mind I changed my links to -d.lib only and it works now, dunno why though.

Haikarainen

  • Guest
Need help with tutorial
« Reply #3 on: July 11, 2011, 03:23:23 pm »
Quote from: "Shriek"
Thanks, but now there's another problem :/. I have included the additional .lib files and it worked but it crashes, so I included the -d.lib files aswell and that didn't help. I get this message when it crashes:

A buffer overrun has occurred in Project3.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

Never mind I changed my links to -d.lib only and it works now, dunno why though.


Use the -d-libs in your debug-target, and regular libs in you release target! :)

 

anything