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.


SFML Directory or File not found


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
8 replies to this topic

#1 SleepySlowpoke   Members   -  Reputation: 112

Like
0Likes
Like

Posted 29 August 2013 - 04:20 PM

I'm starting off and making my first video game, as of now I'm working on the starting screen and title screen. I've made a GameScreen, SplashScreen, and finally a ScreenManager file.
 
The ScreenManager file itself is coded as so (Reminder: I just started this a few hours ago and don't entirely know what I'm doing so don't judge).
 

#ifndef SCREENMANAGER_H
#define SCREENMANAGER_H
#include<string>
#include<iostream>
#include"GameScreen.h"
#include"SplashScreen.h"

#define ScreenWidth 1600
#define ScreenHeight 900
class ScreenManager
{
    public:
        ~ScreenManager();
        static ScreenManager &GetInstance();
        void Initialize();
        void LoadContent();
        void Update();
        void Draw(sf:: RenderWindow &Window)

        virtual ~ScreenManager();
    protected:
    private:
        GameScreen *currentScreen, *newScreen;
        ScreenManager();
        ScreenManager(ScreenManager const&);
        void operator=(ScreenManager const&);
};

#endif // SCREENMANAGER_H

My main file is as so
 

#include <iostream>
#include<SFML/Graphics.hpp>
#include<ScreenManager.hpp>

using namespace std;

int main()
{
sf::RenderWindow Window(sf::VideoMode(ScreenWidth, ScreenHeight, 32), "Dash")



while(Window.isOpen())
{
sf::Event event
if(Window.GetEvent(event))
{
if(event.Type == sf::Event::Closed || event.key.code == sf::Key::Escape)
Window.close();
}
}

return 0;
}

I get an error with #include<ScreenManage.h> saying that there is no such file or directory when compiling.

 

I've checked the name and don't really have enough knowledge or experience to fix the problem by myself, google as well hasn't really helped so if anyone could help me or direct me to a tutorial on how to fix this I would greatly appreciate it.



Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9629

Like
0Likes
Like

Posted 29 August 2013 - 04:32 PM

Is your file named ScreenManager.h or ScreenManager.hpp? Your #include uses the .hpp extension, but you call it a .h file in your post.



#3 SleepySlowpoke   Members   -  Reputation: 112

Like
0Likes
Like

Posted 29 August 2013 - 05:01 PM

Is your file named ScreenManager.h or ScreenManager.hpp? Your #include uses the .hpp extension, but you call it a .h file in your post.

 

It is ScreenManager.h but the other part is ScreenManager.cpp



#4 rijvgt   Members   -  Reputation: 119

Like
0Likes
Like

Posted 29 August 2013 - 05:16 PM

The problem isn't related to SFML. I think you should #include "ScreenManager.h" in your main instead of the cpp cause (even if it didn't pop error)-logically that's your class definition and where creating an object should apply.

 

Hope I helped and goodluck with your game =]

 

//Haven't used it yet but FLARE (rpg) game engine could be helpful in case you're a novice like me, it seems clean and awesome. smile.png


Edited by rijvgt, 29 August 2013 - 05:17 PM.


#5 SleepySlowpoke   Members   -  Reputation: 112

Like
0Likes
Like

Posted 29 August 2013 - 05:56 PM

The problem isn't related to SFML. I think you should #include "ScreenManager.h" in your main instead of the cpp cause (even if it didn't pop error)-logically that's your class definition and where creating an object should apply.

 

Hope I helped and goodluck with your game =]

 

//Haven't used it yet but FLARE (rpg) game engine could be helpful in case you're a novice like me, it seems clean and awesome. smile.png

 

I changed it to <ScreenManager.h> but it still gives me the same error



#6 rijvgt   Members   -  Reputation: 119

Like
0Likes
Like

Posted 29 August 2013 - 06:16 PM

 

The problem isn't related to SFML. I think you should #include "ScreenManager.h" in your main instead of the cpp cause (even if it didn't pop error)-logically that's your class definition and where creating an object should apply.

 

Hope I helped and goodluck with your game =]

 

//Haven't used it yet but FLARE (rpg) game engine could be helpful in case you're a novice like me, it seems clean and awesome. smile.png

 

I changed it to <ScreenManager.h> but it still gives me the same error

 

Mhh you havent posted the file where you implement the screenmanager... but you can see examples from the flare engine on what you are trying to achieve. Even if it has nothing to do with the fact that you're both using SFML, they seem to be following C++ standards.

 

For example you can see the #include "GameSwitcher.h" in the main https://github.com/clintbellanger/flare-engine/blob/master/src/main.cpp

 

And how it is implemented:

https://github.com/clintbellanger/flare-engine/blob/master/src/GameSwitcher.h

https://github.com/clintbellanger/flare-engine/blob/master/src/GameSwitcher.cpp


Edited by rijvgt, 29 August 2013 - 06:17 PM.


#7 Spyderzone   Members   -  Reputation: 182

Like
1Likes
Like

Posted 29 August 2013 - 06:17 PM

Change it to
#include "ScreenManager.h"

#8 SharkBaitHooHaHa   Members   -  Reputation: 271

Like
0Likes
Like

Posted 03 September 2013 - 10:36 PM

Change it to
#include "ScreenManager.h"

^As I recall, all of your personal includes(files that you create yourself) should be surrounded by quotes and not angle brackets. At least that's the rule I follow and it seems to work. As Spyderzone said I believe this is the issue and not xxx.h vs xxx.hpp



#9 BitMaster   Crossbones+   -  Reputation: 4274

Like
0Likes
Like

Posted 04 September 2013 - 02:24 AM

^As I recall, all of your personal includes(files that you create yourself) should be surrounded by quotes and not angle brackets. At least that's the rule I follow and it seems to work. As Spyderzone said I believe this is the issue and not xxx.h vs xxx.hpp


That is not true in general. While it is true that the big three C++ compilers (MSVC, gcc, Clang) use a similar heuristic for "" #includes (add the including file's directory to the search paths), this is not actually enforced by the standard (the standard allows adding an implementation defined heuristic to "" compared to <> but does never qualify what to do). So, writing really standard compliant code would require setting the correct include directory search paths in the build system.

That is something I in general prefer to follow in non-trivial projects.




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