Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: .exe file not found  (Read 3326 times)

0 Members and 1 Guest are viewing this topic.

VotingStatue71

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
.exe file not found
« on: January 07, 2016, 12:40:48 am »
So I got to working with SFML recently, and I've just encountered a problem, that being whenever I attempt and create a sprite, my .exe file removes itself COMPLETELY from my desktop, making anything I attempt to create unworkable after that.

Here is my code:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

#include <iostream>

#include "ResourcePath.hpp"

using namespace std;
int main()
{
        //Variables
        int MaxFPS = 80;


        //Creating the window
        sf::RenderWindow gameWindow(sf::VideoMode(800, 600), "A Technical Problem");


        //Creating the Handler
        sf::WindowHandle theHandle;


        //Controlling the FrameRate
        gameWindow.setFramerateLimit(MaxFPS);


        //Creating the Test Player
        sf::Texture PlayerTexture;
        PlayerTexture.setSmooth(false);
        if (!PlayerTexture.loadFromFile(resourcePath() + "Player1.png"))
        {
                cout << "The Player 1 image did not load properly" << endl;
                return EXIT_FAILURE;
        }
        sf::Sprite PlayerS(PlayerTexture);



        //Main Game Loop
        while (gameWindow.isOpen())
        {


                //Detecting input
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
                {

                }


                //Process Events
                sf::Event theEvent;
                while (gameWindow.pollEvent(theEvent))
                {

                //Closing the Main Game Loop
                        if (theEvent.type == sf::Event::Closed)
                        {
                                gameWindow.close();
                        }
                }


                //Clearing the Game Window
                gameWindow.clear();


                //Drawing the Sprites
                gameWindow.draw(PlayerS);


                //Updating the window
                gameWindow.display();


        }


        return EXIT_SUCCESS;
}
 
And I'm not sure what to do about it: I haven't seen anything similar to this topic on the internet at all (and believe me, I looked), so if someone has an answer to this, please respond so.

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: .exe file not found
« Reply #1 on: January 07, 2016, 12:58:43 am »
So you are building your application, moving the .exe file to your desktop, running it from there, and then it deletes itself? That sounds very strange.

Do you have any antivirus software running? If so, your antivirus might be incorrectly detecting your program as a virus and deleting it.

VotingStatue71

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: .exe file not found
« Reply #2 on: January 07, 2016, 05:35:24 am »
The .exe files are created alongside the project, and the thing that gets me is that I can run a similar project (minus the sprite part) and the .exe file goes nowhere.

I haven't tried doing the doodad with the antivirus, though: I'll try it out and see if that works

VotingStatue71

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: .exe file not found
« Reply #3 on: January 08, 2016, 11:10:24 pm »
Actually reworked the code, piece by piece, and figured out that it has something to do with the ResourcePath that I downloaded off subconscious bias (), and when I remove the resourcePath() function, the .exe file came back!  :D

Is there way else I could replace the resource Path so that I can still access the image for a sprite?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
Re: .exe file not found
« Reply #4 on: January 08, 2016, 11:37:57 pm »
Executables don't just disappear and reappear... ::)

Either the compilation fails and thus you don't get an exe (it disappears) or you have an antivirus software that is detecting your app falsely and removes it from the system.

Make sure you're not getting any compiler errors and try once disabling your antivirus software. It's usually recommended to white-list the directories you're developing in.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: .exe file not found
« Reply #5 on: January 10, 2016, 12:04:34 pm »
A had those programs blems too  :D I simply understood that my project is screwed up and copied sorces to another project and removed old.   8)

 

anything