Hello.
When i close application i always get (Process returned -2147418113 <0x8000FFFF>...)
And sometimes (-1073741819 <0xC0000005> Access Violation) if opened and closed in rapid succession.

I have return 0 at end of the code and i am wondering what may be causing a error like this, since i am using only c++ standard(string, int, enums) and sfml2.0 lib, no pointers or personally using heap memory space.
Before i shutdown all music, close window, and process still returns (-2147418113 <0x8000FFFF>).

The program works as expected, it didn't crash or shutdown for unknown reason. and i run it at least 10min.

Any suggestions on what should i turn my attention towards to fix this problem?
If some personal experience tips.

Most likely somewhere in your cleanup code you're accessing a pointer that is no longer valid (on rereading your post, I should say that) in your calls to SFML you're probably indirectly accessing memory that's already be released. Perhaps the best thing to do is open the program in a debugger, set a breakpoint where the shutdown begins, then step through it until you find the crash. An alternative is to insert printf statements throughout the cleanup code to see if that helps you find it. But using the debugger is likely the better way to go.

Most likely somewhere in your cleanup code you're accessing a pointer that is no longer valid (on rereading your post, I should say that) in your calls to SFML you're probably indirectly accessing memory that's already be released. Perhaps the best thing to do is open the program in a debugger, set a breakpoint where the shutdown begins, then step through it until you find the crash. An alternative is to insert printf statements throughout the cleanup code to see if that helps you find it. But using the debugger is likely the better way to go.

No error but when i reach return 0.End of main and probably where all code is being cleaned up this error pops up

Program received signal SIGSEGV, Segmentation fault.
In ?? () (C:\Windows\system32\nvoglv32.dll)

So the deconstructors are problem?And if so, i have made total of 0 deconstructors.

Just because you didn't create your own destructor (deconstructor isn't the appropriate name, FYI) doesn't mean much. The compiler creates destructors on its own. And you maybe *should* have created destructors.

A few observations. First, tat's quite a lot of globals you have there. You have the following objects that aren't created in main(): objWindow, objFps, objTextures, objFunctions, ,objMainMenu, objOptions, objSquad, objSquadCreation, objAudio

The problem could be in any one of these or even objApp. My theory is that because many of the obj* objects are created and use objApp that there's an issue with how you're storing objApp in the other objects. objApp is destroyed before the globals and this could be causing issues somehow. So, two things you should do. First, create a block around objApp like this:

How old is your SFML2 library? Their was a bug in the RC that caused a similar crash on exit related to the default font used by sf::Text. Explicitly providing a font may solve your crash.

Another common-ish error could be coming from your global objects. The OpenGL context is created along with your sf::RenderWindow. But if one of your globals ends up creating a sf::Texture before your window, then it may cause some problems as the texture depends on the OpenGL context.

line 18 is closing bracket for main...so segmentation error comes after that, but there is no code run after that.

None of your code is run after that, true, but the OS is still doing some cleanup of its own after main exits. This sort of error usually indicates that you're stomping memory somewhere. It's at this point that the OS is freeing up resources, including unloading shared libraries and releasing any remaining memory allocated by the program. It has certain markers it uses to manage this stuff. And if corruption has occurred, for example one of those markers has been overwritten, situations like this can arise where the problem does not manifest during runtime but, rather, at exit. In your particular case, the problem is occurring when the graphics driver is being shutdown, which indicates that memory in driver's space has been corrupted somehow.

There are a number of ways to cause this sort of corruption, but they can be hard to find. If you are using VisualC++, you might be able to get more info by calling _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG_DF)|_CRTDBG_CHECK_ALWAYS_DF) during startup. If that doesn't help, another technique is to comment out most of the program, recompile with only a do-nothing main function, and run it. Then you keep uncommenting more functionality, recompiling, and running again until you get the crash. That will help you hone in on the place where the corruption is occurring.

How old is your SFML2 library? Their was a bug in the RC that caused a similar crash on exit related to the default font used by sf::Text. Explicitly providing a font may solve your crash.Another common-ish error could be coming from your global objects. The OpenGL context is created along with your sf::RenderWindow. But if one of your globals ends up creating a sf::Texture before your window, then it may cause some problems as the texture depends on the OpenGL context.

I will try to update sfml.

line 18 is closing bracket for main...so segmentation error comes after that, but there is no code run after that.

None of your code is run after that, true, but the OS is still doing some cleanup of its own after main exits. This sort of error usually indicates that you're stomping memory somewhere. It's at this point that the OS is freeing up resources, including unloading shared libraries and releasing any remaining memory allocated by the program. It has certain markers it uses to manage this stuff. And if corruption has occurred, for example one of those markers has been overwritten, situations like this can arise where the problem does not manifest during runtime but, rather, at exit. In your particular case, the problem is occurring when the graphics driver is being shutdown, which indicates that memory in driver's space has been corrupted somehow.

There are a number of ways to cause this sort of corruption, but they can be hard to find. If you are using VisualC++, you might be able to get more info by calling _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG_DF)|_CRTDBG_CHECK_ALWAYS_DF) during startup. If that doesn't help, another technique is to comment out most of the program, recompile with only a do-nothing main function, and run it. Then you keep uncommenting more functionality, recompiling, and running again until you get the crash. That will help you hone in on the place where the corruption is occurring.

Commenting out the program... Seems like optimal solution. Thanks on help, its work time now.

EDIT::He...Hello?Em i allive???My code is a spaghetti. After a long commenting out code here are resaults.

int main()
{
sf::Music audio;
return 0;
}

Process returned -2147418113 <0x8000FFFF> execution time : 0.100sPress any key to continue.

So declaring a sf::Music gro... me!!!I have downloaded newest data from sfml, build it with cmake - MinGW and i still get this errorAm gonna make a new thread on sfml forum. If by any chance you can help am glad to hear it.Thanks on support you two, keep up the good work!

EDIT 924:Error is removed by replacing OpenAL32.dll dll file with one from interet. Tho now my application takes 10-15 second to start up.