I am making a breakout game with C using SDL.I am using Code::Blocks.My application does run properly when I am running it from within the IDE.But when i try to run the release .exe file from bin/release folder it only shows a black window .Nothing shows up in the window.There is not any problem with my coding of course since it does run from within code blocks.So i guess I will need to set up something in the build options or something to make it work?
If you're using relative paths to access external assets make sure your working directory is what you expect when you run outside of Code::Blocks.
Related
I have just finished making my first working program (not a hello world program), and I want to be able to run it without opening the program files. I currently use Code::Blocks to code, and there is no way (that I've found) that do that.
What I am talking about, is instead of opening the file, waiting a while (I have a potato) and then clicking run, just to click a desktop icon, which instantly opens the console, and runs the program.
When you are building you application, it creates a folder named "Debug" or "Release" inside your project folder, depends wich target you build. Inside the folder you will find your final executable.
I generated the .exe files by running 'make' for the c++ project g2o. However when I try executing them, a black window appears for a short time, but nothing else happens. Does it mean something went wrong when creating them? I generated them again using the source code from https://github.com/RainerKuemmerle/g2o, which resulted in the same problem.
I have made my project in C++ and used SFMl 2.1, I also have loaded images from disk and when I'm trying to run its .exe file its giving error in image loading.
For now I'm trying to run its own .exe fie (in Debug or Release folder of project).
i want to make this .exe file for my friends who are not programmers so that my game would run on their PCs as well.
If someone know to make .exe so please help!
First, try to put the images beside the exe file.
After that, your friends probably won't have all the development DLL and libs needed for your app to work. You can use depends.exe to know what is needed for your app to start. Put all those file beside your exe and it should work on most PCs.
Bonus tip
Often, when you experience this kind of problem (application crash when starting directly outside the project), the simplest solution, which is language-agnostic, is to make your app write to a new file within your main function and look where it ends up in your project hierarchy after you ran your app directly (outside the IDE/project).
You'll see right there where the relative root of your app is. Most of the time, it's right next to the compiled file, depending on the language you chose.
This shakes my understanding of computers and operating systems on a level that makes me very uneasy. I have just spent about an hour entering different iterations of compile commands to g++ and in my exasperation I renamed the executable which kept having the delay from game.exe to gameg.exe and all of a sudden the problem vanished.
Here's some more background: I was noticing recently that when I ran my Eclipse unit test build, when I start with an SDL enabled test it would open the SDL window and freeze for about 20 seconds before being able to get the test started. On subsequent tests (which call SDL_Quit() and re-initialize SDL as part of the test process) this delay is not present. Now I have ascertained that ONLY when the executable is named exactly "game.exe" does this happen! I rename it to any other filename and it goes along running tests happily, initializing the SDL system within a second like it usually does. I had assumed before that there must be some kind of bug that was causing my Eclipse build to have this behavior which wasn't present in the makefile build, but it turns out if I take the eclipse build and rename its executable (the project folder it's in is called game hence game.exe) it doesn't exhibit the behavior.
Likewise I take my makefile build (whose filename is entropy_unittest_disp.exe fyi) and rename it to game.exe and it begins to do this. I rename it to game and it also does it (I am running from mingw's bash.. when not with .exe extension, explorer doesn't know it's an executable). However I changed it to game.exx and it worked normally.
WHAT IS THIS BLACK MAGIC? Why should a program function differently depending on its filename??? I do query argv[0] and i actually do it to print to console its value (for debug purposes) but unsurprisingly it just prints the program and its path. No logic is ever performed on it in my program.
I tried to run GDB to find out where it is freezing but once I press Ctrl+C GDB simply exits.
does anybody have any idea what this might be caused by? A virus?
edit: I downloaded this demo from this site: http://www.sdltutorials.com/sdl-opengl-tutorial-basics/
extracted it, renamed the file to game.exe, and yup, same thing happens. WHAT IS THIS? I'm going to try running dependency walker next to see if something's trying to hook into it.
I'm assuming you have either a AMD (ATI) or Nvidia graphics card with their official drivers.
Chances are, game.exe is the executable name for an actual game released and your drivers are running special optimizations for the "game" or loading the Crossfire or SLI profiles for this game. A quick Google search seems to tell me that Resident Evil 4 calls their executable "game.exe."
I recommend taking a look at this link for further details as to what may be happening:
http://www.kn00tcn.net/site/ati-catalyst-profiles/
not sure how to reply to steven's comment on the top answer, but regarding driver profiles, it's just a basic brute force check of .exe filenames
some games are guaranteed to be in a specific sub folder, so the driver looks for where the exe is located, such as '\team fortress 2\hl2.exe'
but since most games let you pick what folder name you're installing to, & a lot of the time the exe is in that same root folder, the drivers have no choice but to blindly assume gameX.exe is going to be gameX
a nice 'side effect' of this is you can force other game profiles on any game for troubleshooting purposes, or to try to enable CF/SLI scaling
so always try to make sure that your executable has an original name to know that the gfx driver isnt attempting to run 'optimizations' made exclusively for other games
Could this be due to Anti virus software running on your OS? Certain files are commonly used in Virus "Game.exe" could be one of them and hence additional care from OS / AV to ensure that it is safe
Test it in clean windows, without any extra software installation, if it work fine, then maybe you have some protection software like Anti-virus or sandbox , ... , if you have any of this software disable them, and test again
Check to see if game.exe is listed in the Image File Execution Options registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options. It can be used to launch a particular program as a debugger for an application with a particular name. (More info on Image File Execution Options)
An EXE will behave differently based on its name due to AppCompat Shimming. Check the loaded module list and see if there are a bunch of DLLs that start with "ac" loaded into your app.
I've been instructed to download and install FlashDevelop and it seems fine but I don't know how to generate exe files when writing programs in Haxe. I try to Build or Run the project in FlashDevelop BUT it just doesn't do anything. Can anybody please advise me on how to do this?
Thank you
The CPP target is the youngest in the Haxe world and so still a little rough on the edges; add in more complexity because it depends on external tools to properly work.
Made that premise, try to create a new Haxe/CPP project in FlashDevelop, open the Main class and add a simple trace("hello world!"); line. Hit F5 to start the "compile and run" process.
You'll see in the status bar the message "Build started ..." and you can follow the process looking at the "Output Panel". If your environment is set correctly it will compile the whole project and open a DOS window where it will execute the generated executable (you can find it in the bin folder).
If you receive an error then your environment is not yet ready to build CPP applications with Haxe. To fix that follow the setup instructions you can find here.
An easy alternative to produce native execubles (yes, you can compile the same for Win/Mac/Linux) you can target neko to produce a .n file and nekotools to transform it in the exe form. Just type:
nekotools boot main.n