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

Author Topic: Access violation reading location  (Read 1270 times)

0 Members and 2 Guests are viewing this topic.

FrancuzZ

  • Newbie
  • *
  • Posts: 2
    • View Profile
Access violation reading location
« on: October 23, 2018, 09:10:32 pm »
Hello.

I've been trying to display some text on the window, but I have a problem with the same error as in topic.
The code from main.cpp:
https://snag.gy/Tq75bC.jpg

Also, the code from menu.h and menu.cpp:
https://snag.gy/lW0OGP.jpg
https://snag.gy/Whf3dJ.jpg

When I delete all content from menu.cpp and menu.h in main file the problem disappears, so I think the problem lies in those two files.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Access violation reading location
« Reply #1 on: October 23, 2018, 09:46:42 pm »
If you set your project to debug mode and use the SFML debug libraries you may get more information on the crash.

The font object in your menu must be kept alive as long as you're using it with your text object.

Alternatively there could also be something wrong with using x64 DLLs while using the x86 compiler.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FrancuzZ

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Access violation reading location
« Reply #2 on: October 23, 2018, 10:10:25 pm »
I've tried to run program in debug mode:
https://snag.gy/GbgSiU.jpg

Also changed a bit menu.cpp and main.cpp files:
https://snag.gy/WPrUOl.jpg
https://snag.gy/eH1iZf.jpg

So, how can I keep those fonts alive during the executing of program?