Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

c++ SFML issue. Help!

4: Adsense

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   

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.


#2 drakogate   Members   

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   

10277
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   

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 love_to_code   Members   

122
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.