-
I am working through thye window tutorial:
#include <SFML/Window.hpp>
int main()
{
sf::Window window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
and these errors occurred:
class sf::Window has no member named "is open"
and the same error for other members.
The code is copied straight from the tutorial.
I am using linux Ubuntu with codeblocks.
Please help
-
Did you run through the setup tutorials? http://www.sfml-dev.org/tutorials/2.0/start-cb.php and/or http://www.sfml-dev.org/tutorials/2.0/start-linux.php
-
It automatically installed all the libraries from the ubuntu software manager. The default code-blocks program works but no other program I have tried. I followed the above links and they didn't help.
-
Did ubuntu install the SFML2.0 libraries or the 1.6? Some method calls were changed in between the versions, I think 1.6 had capital calls, 'IsOpen()" as opposed to 2.0 'isOpen()'
I've also never developed on a linux distro so I can't help you with any info on your linker settings, which may also be the case.
-
Haven't been on Ubuntu for a while, but I don't think they've already switched to SFML 2.0, thus you'll have to recompile & install SFML on your own, without the package manager (see the CMake tutorial).
Working with SFML 1.6 is not recommended, since it's outdated, unmaintained, buggy and lacks quite a few features. ;)
-
I only started with Linux yesterday. Please, I am a n00b!
Can someone just tell me what to do.
-
I only started with Linux yesterday. Please, I am a n00b!
Can someone just tell me what to do.
We already told you what to do, if ubuntu automatically installed SFML 1.6 then uninstall it and compile from the source. ;)
-
In your console, type:
sudo apt-add-repository ppa:sonkun/sfml-development
sudo apt-get update
sudo apt-get install libsfml-dev
Optionally:
sudo apt-get install sfml-examples
sfml-shader # should run the shader example
-
did that it says I have the latest version. I have also downloaded it from the sfml website and tried linking it to code::blocks but it doesn't work.
-
We already told you what to do, if ubuntu automatically installed SFML 1.6 then uninstall it and compile from the source. ;)
How do you do this?
-
http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php
-
Still not working :(
so far:
I have downloaded code blocks and g++ from the ubuntu app store and this works with c++ standard
I have tried sfml 1.6 from app store
I have downloaded sfml 2.0
I have tried all above
in cmake this error occurred
CMake Error at CMakeLists.txt:4 (add_subdirectory):
add_subdirectory given source "bash-completion" which is not an existing
directory.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-
Maybe google some tutorials for making sure your dev environment is setup corretly first. Then google some tutorials on compiling from source on linux then give it another shot. Maybe SFML didn't get installed into your systems Standard Path for some reason. Or if you are using code blocks 12.11 it won't work with the 'official' SFML release and you need to download a nightly build. I know the Windows version has this problem, the linux may have the same.
Maybe developing on a Linux Distro is just a tad out of reach for your knowledge base right now. I know that even using any flavor of linux requires a decent chunk of knowledge on how to do things like pull from repositories and compile from source to get a certain program to work on your specific distro. Everytime I've ever even touched linux I break it beyond usability within a day. I can imagine trying to set up a developement environment is an even bigger headache than general usage. Heck, even just getting a dev environment setup under windows can be nerve racking and thats usually just unzip, set linker settings and your golden.
-
Solved. I manually installed the sfml libary to standered path - at least, I think I did it manually, the sudp apt-get install thing might have done it. Then with code::blocks I chose sfml project.
I want to thank the hatchet for his/her help
-
There are also two versions of SFML 2.0, codeblocks comes with both the .DLL's of the two different SFML versions for some reason, this caught me out when I first started.