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

Author Topic: [SOLVED] Making window causes crash  (Read 3365 times)

0 Members and 1 Guest are viewing this topic.

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
[SOLVED] Making window causes crash
« on: August 05, 2017, 12:26:49 am »
I've recently been trying to use the SFML libraries in order to go along with my learning of C++. Please understand that I've only started attempting this today, and my knowledge may be lacking.


This code:
------
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "Hello World");
    return 0;
}
------

Causes a giant error, though the first few lines:
------
*** Error in `./wontwork': free(): invalid pointer: 0x00005644c95ccd68 ***

This is then followed by a backtrace, and a memory map.
------

Implies that some pointer to a variable/object is either invalid or the include/library is missing. I've been trying to start on SFML for quite a few hours now, and searching on Google didn't quite help. I have followed up to three tutorials on linking these libraries.

I have linked the following libraries:

sfml-graphics
sfml-window
sfml-audio
sfml-network
GL
sfml-system


I am using CodeLite on Ubuntu 17.04.
« Last Edit: August 05, 2017, 05:26:43 am by TheDeceivingEye »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: Making window causes crash (core dumped)
« Reply #1 on: August 05, 2017, 12:34:09 am »
How did you acquire SFML?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #2 on: August 05, 2017, 12:37:31 am »
https://www.sfml-dev.org/download/sfml/2.4.2/

Here. The 64-bit Linux variant.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: Making window causes crash (core dumped)
« Reply #3 on: August 05, 2017, 12:42:40 am »
You're better off using the binaries provided by your package manager or building SFML from source.
Given the various Linux distros and all their different library versions, chances are high that some lib randomly compiled on a system aren't compatible with your system.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #4 on: August 05, 2017, 12:45:28 am »
I'll quickly try that and get back to the forums if something goes wrong. Thanks.

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #5 on: August 05, 2017, 01:04:43 am »
"CMake Error at cmake/Modules/FindUDev.cmake:49 (MESSAGE):
  Could not find UDev library
Call Stack (most recent call first):
  src/SFML/Window/CMakeLists.txt:242 (find_package)"


Configuration error. UDev is most certainly not missing. I'll try the one from GitHub.
« Last Edit: August 05, 2017, 01:11:09 am by TheDeceivingEye »

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #6 on: August 05, 2017, 01:07:23 am »
Apparently the "udev" package from the repos is perfectly up to date and present.

Edit: I tried both the package from GitHub and the one from the downloads page, the one labeled "source," and the exact same problem is occurring.
« Last Edit: August 05, 2017, 01:11:25 am by TheDeceivingEye »

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #7 on: August 05, 2017, 01:15:24 am »
I have tried, now, the repository variant as well to no avail. The "libsfml-dev" package available for my system.

Could it be that Ubuntu 17.04 isn't compatible? If this is the case, then it's too big of a jump to move back to 16.04, I might have to forget using SFML.

TheDeceivingEye

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Making window causes crash (core dumped)
« Reply #8 on: August 05, 2017, 01:36:18 am »
Good news:

I used NetBeans, and everything works fine. Also, I used the package from the repos, and added /usr/include and /usr/local/include for my include options, and the /usr/lib and /usr/local/lib for the libraries. Everything works.

However, I instead am now using the slightly outdated G++-4.9, which seems to, however, work fine.

Thanks for the suggestion of getting it from the repos instead.

Nester

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: [SOLVED] Making window causes crash
« Reply #9 on: August 21, 2017, 09:34:25 am »
Good news:

I used NetBeans, and everything works fine. Also, I always got some pre workout before gym and used the package from the repos, and added /usr/include and /usr/local/include for my include options, and the /usr/lib and /usr/local/lib for the libraries. Everything works.

Thanks for fixing! The crashing was getting annoying!
« Last Edit: October 29, 2024, 09:49:49 am by Nester »