Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


c++ SFML issue. Help!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 drakogate   Members   -  Reputation: 104

Like
0Likes
Like

Posted 23 July 2013 - 03:22 PM

****SOLVED****

 

Okay, so I just installed SFML on Visual C++ and i'm working some tutorials and whatnot.  Anyways i'm having a big problem.  Here's my code.

 

// Libraries
#include <SFML/Window.hpp>
#include <iostream>
using namespace sf;
using namespace std;
 
// Global variable, functions, classes
 
 
int main()
{
//Create the window parameters
sf::RenderWindow window(VideoMode(800, 600), "Grole");
//(FPS = NUMBER OF TIMES GAME USUALLY LOOPS.  NORMALLY 60 FPS)
window.setFramerateLimit(60); //Game loop will repeat 60 times per second
 
 
bool running = true;
 
//Game loop (infinite loop that reapeats until user decides to close game.
while (running == true)
{
 
//EVENTS
Event event;
//Check all events that are happening in between each frame
while (window.pollEvent(event))
{
 
}
 
//LOGIC
 
 
//RENDERING
window.clear();
 
window.display();
}
 
//////////////
 
//Clean up
window.close();
 
return 0;
 
}

 

 

 

When I use sf::RenderWindow my compiler tells me "Error: namespace "sf" has no member "RenderWindow".  Anyone know how to solve this problem?  

 

Thanks!


Edited by drakogate, 23 July 2013 - 03:26 PM.


Sponsor:

#2 drakogate   Members   -  Reputation: 104

Like
-1Likes
Like

Posted 23 July 2013 - 03:26 PM

I figured out the problem.  I don't know if I can delete this so i'll just write solved at the top.  Thanks!



#3 Brother Bob   Moderators   -  Reputation: 8453

Like
0Likes
Like

Posted 23 July 2013 - 03:45 PM

Why don't you contribute to the community you're requesting assistance from by post your solution for other to learn from?



#4 drakogate   Members   -  Reputation: 104

Like
0Likes
Like

Posted 23 July 2013 - 07:22 PM

 

// Libraries

#include <SFML/Window.hpp>
#include <iostream>

 

Needed to change this bit of code to:

 

 

#include <SFML/Graphics.hpp>

#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <iostream>

 

Never really used this kind of forum.  Sorry about that.  



#5 Yemeni Cpluspluser   Members   -  Reputation: 107

Like
1Likes
Like

Posted 31 July 2013 - 02:39 PM

I would recommend that you don't use using name space sf;
so that you can know sf:: functions from other c++functions.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS