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

Author Topic: Access Violation.  (Read 10866 times)

0 Members and 3 Guests are viewing this topic.

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« on: August 28, 2011, 11:43:02 pm »
A few things first.

Can SFML run on VS2010? I've noticed that there are not any files for this version.

Can I create a window from SFML to run on a 32" TV? I use this as my monitor via HDMI.
I've noticed a few people having problems with having more than one monitor etc.


So, here's the code that compiles, it's the tutorial code for the window:
Code: [Select]
#include "stdafx.h"

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

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}


This is what gives me the access violation as soon as it opens a console window. The code compiles fine.

In debug, I have these lines within the call stack window:
>   nvoglv32.dll!6980e3c3()    
    [Frames below may be incorrect and/or missing, no symbols loaded for nvoglv32.dll]   
    nvoglv32.dll!69820fdc()    
    nvoglv32.dll!6975eba0()

I've linked everything correctly, that I'm aware of and included the window.hpp within my stdafx.h.

If anyone could shed some light on this, as to why it's not working or something I am doing wrong, I'd be very greatful, thanks.

EDIT: Just some more info.

I'm running Windows 7 x64.
Nvidia GeForce GTX 550 Ti with the latest drivers.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #1 on: August 29, 2011, 08:15:49 am »
Quote
Can SFML run on VS2010?

No, so you must recompile it ;)
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #2 on: August 29, 2011, 01:36:40 pm »
Thanks for the reply. I did a lot of reading around last night, managed to build the files, I think... lol.

I've never had to build any files before, but what I got from the tutorial on here and some forum posts, I managed to get these files with CMake.



After using CMake to create these files, I then loaded ALL_BUILD.vcxproj and pressed F7 ( Build ).

I also add the additional dependancies:
Properties > Linker > Input > Additional Dependancies
   sfml-system.lib;sfml-graphics.lib;sfml-window.lib;sfml-audio.lib;sfml-network.lib

From what I'm doing, this should now work correctly?
Do I still need to add the include/lib directories? Now that they are in the VS2010 directoy.

I can still run the clock tutorial from this site, but as soon as I add a line to create a render window, I always get the 0x05 access violation error.

Code: [Select]
int _tmain(int argc, _TCHAR* argv[])
{
//error here
//sf::RenderWindow App( sf::VideoMode( 800, 600, 32 ), "My SFML Window" );

    sf::Clock Clock;

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

if( _kbhit() )
break;
    }

    return 0;
}


Sorry if you think I'm dumb, lmao. Been at this ( trying to get it to work ) for too long now.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #3 on: August 29, 2011, 02:00:48 pm »
Oh, it's SFML 2. I thought you were using SFML 1.6 because you said "there's no file for VC++ 2010" -- SFML 2 is not released so there's no file at all (for any version of any compiler on any OS) ;)

If you compile in debug mode you must link the debug libraries (sfml-system-d.lib etc.).
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #4 on: August 29, 2011, 02:24:04 pm »
Yeah, I tried to use both of them. I just deleted it all and tried to start again. Is it possible to rebuild the files from the 1.6 so that they work in VS2010?
If so, how? lol.

When I use the vs2008 files, I can compile the clock code from above and it works fine, but that's compiling in debug and using the sfml-system.lib. I always get errors when I link to -d libs.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #5 on: August 29, 2011, 02:30:12 pm »
Quote
Is it possible to rebuild the files from the 1.6 so that they work in VS2010?

Of course. Open build/vc2008/SFML.sln, convert it using the wizard, and compile it.

But SFML 2 should work fine with VC++ 2010 if you followed the tutorial step by step.
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #6 on: August 29, 2011, 02:56:55 pm »
ok, I'm sorry for being really dumb here ):

I just deleted everything to do with SFML, yet again, from my download folders and from the VC directories.

I've built all the files etc ( from 2.0 again ), do I need to copy anything from the built files to the VC directories, as when I use '#include <SFML/...>' I don't even have the folder there to pick an .hpp file.

I'm sure last time I did this, it added all the include files into the VC directory for me.

I tried to link the '...lib\Release' where all the build files are, but nothing.

Cheers for trying to help me! lol.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #7 on: August 29, 2011, 03:15:00 pm »
Quote
I'm sure last time I did this, it added all the include files into the VC directory for me.

Nop. You must tell your compiler where the headers and libs are (it is explained in the SFML 1.6 tutorials).
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #8 on: August 29, 2011, 03:20:33 pm »
Sorry, I thought I posted back in here a minute ago.

I copied the "...2.0\include\SFML" to my VC directory. I have the clock code running fine again. But as soon as I add the render window line in, it just gives me the 0x05 error ):

Edit
:
Actually, I'm not getting the 0x05 access violation now. It just crashes... lol

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name:   clock.exe
  Application Version:   0.0.0.0
  Application Timestamp:   4e5b9263
  Fault Module Name:   nvoglv32.DLL

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #9 on: August 29, 2011, 03:28:29 pm »
You're still using the -d libraries in debug mode, right? ;)

If you use the dynamic libraries, make sure that your program is using the right .dll files.
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #10 on: August 29, 2011, 03:39:44 pm »
Any way I try it, I get an access violation.

This is my additional dependancies:
sfml-system-d.lib
sfml-graphics-d.lib
sfml-window-d.lib

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #11 on: August 29, 2011, 03:52:43 pm »
You didn't answer my question (ok, that wasn't exactly a question...) about DLL files.
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #12 on: August 29, 2011, 04:21:51 pm »
Quote from: "Laurent"
You didn't answer my question (ok, that wasn't exactly a question...) about DLL files.


Oh, yeah. lol. I've tried linking every which way. I just can't figure this out :/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Access Violation.
« Reply #13 on: August 29, 2011, 04:28:27 pm »
I'm not talking about linking, I'm talking about which DLL files are used when you launch your executable.
Laurent Gomila - SFML developer

Lynx876

  • Newbie
  • *
  • Posts: 11
    • View Profile
Access Violation.
« Reply #14 on: August 29, 2011, 04:32:50 pm »
Quote from: "Laurent"
I'm not talking about linking, I'm talking about which DLL files are used when you launch your executable.


You mean the one's you copy to the executable folder for runtime? Sorry, everything I've ever written in C++ games/apps, I've never used any other dll's etc.

If you do mean them, I've copied the dll's from the build I did of them "SFML\x86Build\lib\Release" or "SFML\x86Build\lib\Debug"