SFML community forums

Help => General => Topic started by: dusan on May 24, 2012, 08:15:14 pm

Title: Problem with sf::Event
Post by: dusan on May 24, 2012, 08:15:14 pm
Hello,
I have just started using sfml 2.0. I set up everything, copy some code, paste it when I try to run i got this error :
Error   1       error C2079: 'Event' uses undefined class 'sf::Event'   c:\users\NAME\documents\visual studio 2010\projects\sfml test application\sfml test application\main.cpp        12
 
Problem is about sf::Event and I cannot do much without that class.
Here is print screen:
(http://img96.imageshack.us/img96/8585/slikadp.jpg)
Do you know what is the problem.
ps.
I am not shure is this topic in right section.
pss.
Search didnt help about this.
Title: Re: Problem with sf::Event
Post by: eXpl0it3r on May 24, 2012, 11:50:22 pm
Is this the SFML 2rc?

Also how did you setup your project?
Title: Re: Problem with sf::Event
Post by: dusan on May 25, 2012, 09:51:06 am
I had a problem setting it and solution that worked for me is with CMake and SFML 2.0 snapshot then build debug and release in msvc++, then link them with project and put all dll's into folder with .exe file.
I dont know is it 2rc.
Title: Re: Problem with sf::Event
Post by: eXpl0it3r on May 25, 2012, 10:45:40 am
If you've downloaded the latest source from GitHub then you've got the Release Candidate.
Your building steps sound good, did you follow the tutorial  (http://www.sfml-dev.org/tutorials/2.0/start-vc.php)when setting up VS?

Try to rename Event to something else.

The problem is that MSVC doesn't find the declaration of sf::Event although you include Graphics.hpp, which includes Window.hpp, which includes Event.hpp.
If you follow the tutorial step by step it should work. ;)
Title: Re: Problem with sf::Event
Post by: dusan on May 25, 2012, 11:06:31 am
Already did all stuff that you wrote - nothing helped. And yes I followed tutorial.
But when I downloaded SFML 2.0 snapshot and extract it at the end it give me some error :
!   C:\Users\NAME\Desktop\LaurentGomila-SFML-2.0-rc-24-gac9bda5.tar.gz: Cannot open Versions\Current\Resources (LaurentGomila-SFML-ac9bda5\extlibs\libs-osx\Frameworks\sndfile.framework\Resources --> Versions\Current\Resources)
!   C:\Users\NAME\Desktop\LaurentGomila-SFML-2.0-rc-24-gac9bda5.tar.gz: Symbolic link points to missing file
 
I have just ignored but now it come on my mind.
Could this be problem ?
Title: Re: Problem with sf::Event
Post by: dusan on May 25, 2012, 12:00:31 pm
I found what is wrong.
Lock thread.

If you are interested or have this or similar problem all you have to do is
#include <SFML/Window/Event.hpp>
Title: Re: Problem with sf::Event
Post by: Laurent on May 25, 2012, 12:13:43 pm
I wouldn't consider this problem solved, because, like eXpl0it3r said:
Quote
The problem is that MSVC doesn't find the declaration of sf::Event although you include Graphics.hpp, which includes Window.hpp, which includes Event.hpp.
You should check that in your SFML headers.