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

Author Topic: Buffer overload in release build  (Read 3849 times)

0 Members and 1 Guest are viewing this topic.

Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Buffer overload in release build
« on: February 24, 2011, 04:40:13 am »
For some reason on my version of VC++ 2010 i cant create a release build. I keep gettin a buffer overrun error. What could be the problem? I linked my libs fine because i can run it in debug.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Buffer overload in release build
« Reply #1 on: February 24, 2011, 07:33:03 am »
Have you recompiled SFML? Are you sure that you don't link to the debug libraries in release mode?
Laurent Gomila - SFML developer

Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Buffer overload in release build
« Reply #2 on: February 24, 2011, 12:52:01 pm »
im pretty sure that im linking to the right libs. could you explain to me how to recompile everything and how to set up the right library?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Buffer overload in release build
« Reply #3 on: February 24, 2011, 02:05:36 pm »
This is explained in the tutorials :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Buffer overload in release build
« Reply #4 on: February 24, 2011, 05:02:48 pm »
i followed the tutorial and linked the right libraries but it still gives me the buffer overrun warning

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Buffer overload in release build
« Reply #5 on: February 24, 2011, 05:32:33 pm »
Source code example that reproduces the error?

It could be completely unrelated to SFML.

Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Buffer overload in release build
« Reply #6 on: February 24, 2011, 10:00:17 pm »
Code: [Select]
#include <SFML/Graphics.hpp>
#include <cstdlib>


int main()
{
sf::RenderWindow game(sf::VideoMode(1000, 700, 32), "Pong!");

//Images/Loading
sf::Image Ball;
sf::Image LeftPaddle;
sf::Image RightPaddle;
sf::Image Background;
sf::Image Gameover;

LeftPaddle.LoadFromFile("Leftpaddle.png");
RightPaddle.LoadFromFile("Rightpaddle.png");
Ball.LoadFromFile("PongBall.png");
Background.LoadFromFile("background.png");
Gameover.LoadFromFile("gameover.png");

//Sprites
sf::Sprite leftpaddle;
sf::Sprite rightpaddle;
sf::Sprite ball;
sf::Sprite background;
sf::Sprite gameover;

ball.SetImage(Ball);
leftpaddle.SetImage(LeftPaddle);
rightpaddle.SetImage(RightPaddle);
background.SetImage(Background);
gameover.SetImage(Gameover);

Ball.CreateMaskFromColor(sf::Color(255, 0, 255, 255));
LeftPaddle.CreateMaskFromColor(sf::Color(255, 255, 255, 255));
RightPaddle.CreateMaskFromColor(sf::Color(255, 255, 255, 255));

ball.SetPosition(500, 350);
leftpaddle.SetPosition(0, 250);
rightpaddle.SetPosition(1000 - RightPaddle.GetWidth(), 250);
background.SetPosition(250, 200);


//Ball Movement
float move_x = -1.5;
float move_y = 0;


sf::Event close;

while (game.IsOpened())
{
game.GetEvent(close);

if (close.Type == sf::Event::Closed)
{
game.Close();
}

if (game.GetInput().IsKeyDown(sf::Key::Escape))
{
game.Close();
}


//Collision for everything
float ballX = ball.GetPosition().x;
float ballY = ball.GetPosition().y;
float leftPaddleX = leftpaddle.GetPosition().x;
float leftPaddleY = leftpaddle.GetPosition().y;
float rightPaddleX = rightpaddle.GetPosition().x;
float rightPaddleY = rightpaddle.GetPosition().y;

sf::IntRect ballcollision = ball.GetSubRect();
sf::IntRect leftPaddleCol = leftpaddle.GetSubRect();
sf::IntRect rightPaddleCol = rightpaddle.GetSubRect();

ballcollision.Offset(ballX, ballY);
leftPaddleCol.Offset(leftPaddleX, leftPaddleY);
rightPaddleCol.Offset(rightPaddleX, rightPaddleY);


//Ball Movement
ball.Move(move_x, move_y);


//Left Paddle Controls
if (game.GetInput().IsKeyDown(sf::Key::W))
{
leftpaddle.Move(0, -1);
}

if (game.GetInput().IsKeyDown(sf::Key::S))
{
leftpaddle.Move(0, 1);
}

//Right Paddle Controls
if (game.GetInput().IsKeyDown(sf::Key::Up))
{
rightpaddle.Move(0, -1);
}

if (game.GetInput().IsKeyDown(sf::Key::Down))
{
rightpaddle.Move(0, 1);
}


//Left Paddle Collision
if (leftPaddleCol.Top < 0)
{
leftpaddle.SetY(0);
}

if (leftPaddleCol.Bottom > 700)
{
leftpaddle.SetY(700 - LeftPaddle.GetHeight());
}


//Right Paddle Collision
if (rightPaddleCol.Top < 0)
{
rightpaddle.SetY(0);
}

if (rightPaddleCol.Bottom > 700)
{
rightpaddle.SetY(700 - RightPaddle.GetHeight());
}


//Ball Collision
if (ballcollision.Intersects(leftPaddleCol) && move_x < 0.0f)
{
move_x = -move_x;
move_y = move_y == 0.0f ? -1.5 : move_y;
}

if (ballcollision.Intersects(rightPaddleCol) && move_x > 0.0f)
{
move_x = -move_x;
move_y = move_y == 0.0f ? -1.5 : move_y;
}

if (ballcollision.Bottom > 700)
{
move_y = -1.5;
}

if (ballcollision.Top < 0)
{
move_y = 1.5;
}

if (ballcollision.Left < 0)
{
gameover.SetPosition(250, 200);
game.Draw(gameover);
game.Display();
sf::Sleep(3);
return EXIT_SUCCESS;
}

if (ballcollision.Right > 1000)
{
gameover.SetPosition(250, 200);
game.Draw(gameover);
game.Display();
sf::Sleep(3);
return EXIT_SUCCESS;
}




game.Clear();
game.Draw(background);
game.Draw(ball);
game.Draw(leftpaddle);
game.Draw(rightpaddle);
game.Display();
}




return EXIT_SUCCESS;
}


and here are the errors i get:

Code: [Select]
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\Release\Paki Pong.exe', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-system.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcp90.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcr90.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-window.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-graphics.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Program Files (x86)\Common Files\Motive\McciContextHook_DSR.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\oleacc.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
First-chance exception at 0x70760149 in Paki Pong.exe: 0xC0000005: Access violation reading location 0x64646170.
A buffer overrun has occurred in Paki Pong.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.
The program '[1216] Paki Pong.exe: Native' has exited with code 0 (0x0).

noob4ever

  • Newbie
  • *
  • Posts: 9
    • View Profile
Buffer overload in release build
« Reply #7 on: February 24, 2011, 10:05:50 pm »
Code: [Select]
First-chance exception at 0x70760149 in Paki Pong.exe: 0xC0000005: Access violation reading location 0x64646170.

i had the same error when i hadn't recompiled SFML.
so, recompile SFML with cmake, link the correct libraries and it will run.

 

anything