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

Author Topic: Changing from dev c++ to visual studio 2012  (Read 2281 times)

0 Members and 1 Guest are viewing this topic.

idontmakesense

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Changing from dev c++ to visual studio 2012
« on: September 13, 2013, 02:42:30 pm »
I first got sfml up and running perfectly in visual studio 2012(got the green circle and everything).

Then I copy-pasted the code, since it was a small project containing only a main file.
Next I pasted a few sprites which I'm using in the code in the debug folder of my project in visual studio.

The project compiles and builds fine. When I run it, I get an unhandled exception with msvcr110.dll in braces.

Help will be really appreciated. 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: Changing from dev c++ to visual studio 2012
« Reply #1 on: September 13, 2013, 02:50:18 pm »
Run it through the debugger and find out where things go wrong with a call trace back.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

idontmakesense

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: Changing from dev c++ to visual studio 2012
« Reply #2 on: September 13, 2013, 03:08:07 pm »
Problem occurs when the image is being loaded in the texture variable. Where exactly do i need to save the '.png' files? Or do i have the give the full path name? Right now there are in the debug folder along with the sfml dlls and project application/run file

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: Changing from dev c++ to visual studio 2012
« Reply #3 on: September 13, 2013, 03:20:27 pm »
You put it in the working directory, which can be changed in the project settings. By default Visual Studio sets it next to the project file.
Also failing to load an image should not crash the application, instead it should simply output a message on the console.

Do you have a minimal but complete example code?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

idontmakesense

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: Changing from dev c++ to visual studio 2012
« Reply #4 on: September 13, 2013, 03:41:35 pm »
Im sorry I didn't get you...

This is the part of the code till it runs.

Quote
#include<SFML/Graphics.hpp>
#include<iostream>
#include<cmath>

#define PI 3.14159265

using namespace std;

int main()
{
   const int xRes= 1300;
   const int yRes= 700;
   
   sf::RenderWindow window(sf::VideoMode(xRes, yRes), "Window");
   
   float carLength= 35, carBreadth= 15, bulletLength= 20, bulletBreadth= 10;
   
   float xCar= 100, yCar= 100;
   sf::Texture car_texture, bullet_texture;
   if(!car_texture.loadFromFile("black_car.png"))
      cout<<"Could not load image file"<<endl;

Then it breaks saying...

Quote
First-chance exception at 0x748EDCF8 (msvcr110.dll) in sfml_prac.exe: 0xC0000005: Access violation reading location 0x00511000.
Unhandled exception at 0x748EDCF8 (msvcr110.dll) in sfml_prac.exe: 0xC0000005: Access violation reading location 0x00511000.