SFML community forums

Help => General => Topic started by: xeniac on March 26, 2022, 01:08:24 pm

Title: Can't compile code from tutorial
Post by: xeniac on March 26, 2022, 01:08:24 pm
Hello everyone!
I'm trying to compile program from this tutorial: https://www.sfml-dev.org/tutorials/2.5/start-linux.php (https://www.sfml-dev.org/tutorials/2.5/start-linux.php). I have Ubuntu 20.04, SFML 2.5.1. My sequence of actions:
g++ -c main.cpp -I/home/xenia/Documents/SFML/include
g++ main.o -o sfml-app -L/home/xenia/Documents/SFML/lib -lsfml-graphics -lsfml-window -lsfml-system

Full error message is here: https://anotepad.com/note/read/9986fexc (https://anotepad.com/note/read/9986fexc).

I do not know what to do. I searched the internet and it didn't come up with any results. A year ago, I downloaded the library and wrote simple examples, there was no such error. I remember that I started exactly the same way. Now I've decided to use it again.

Thank you in advance!
Title: Re: Can't compile code from tutorial
Post by: eXpl0it3r on March 26, 2022, 04:36:04 pm
You need to install the necessary dependencies.
See also: https://www.sfml-dev.org/faq.php#tr-lnx-compile
Title: Re: Can't compile code from tutorial
Post by: xeniac on March 26, 2022, 04:45:57 pm
I did sudo apt-get install libx11-dev libgl1-mesa-dev libudev-dev libfreetype6-dev libopenal-dev libflac-dev libvorbis-dev.

It didn't help, unfortunately. The errors are the same: https://anotepad.com/note/read/4eyicmm3 (https://anotepad.com/note/read/4eyicmm3)
Title: Re: Can't compile code from tutorial
Post by: eXpl0it3r on March 26, 2022, 05:47:53 pm
Did you build SFML yourself?
Title: Re: Can't compile code from tutorial
Post by: xeniac on March 26, 2022, 06:15:59 pm
No, I didn't. Maybe try uninstalling and reinstalling?
Title: Re: Can't compile code from tutorial
Post by: Stauricus on March 26, 2022, 09:29:15 pm
did you install it trough "apt-get install libsfml-dev"?
Title: Re: Can't compile code from tutorial
Post by: xeniac on March 29, 2022, 09:55:06 pm
Yes, I tired the library with this command.

I just reinstalled it. It did not help.
Title: Re: Can't compile code from tutorial
Post by: Stauricus on March 30, 2022, 12:35:20 pm
ok, so its probably not about missing dependencies.

are you using some IDE, like Code::Blocks of Visual Studio?
Title: Re: Can't compile code from tutorial
Post by: xeniac on March 30, 2022, 07:41:50 pm
I write code in Sublime Text, but compile and run it manually on the command line.