Note that there are some explanatory texts on larger screens.

plurals
  1. POSFML Window Doesn't Appear
    primarykey
    data
    text
    <p>I've been working with SFML to create a small game on the side recently - everything has been surprisingly quick and simple right up until this evening. I'm away from my usual work-station and doing a bit of clean-up on a windows 8 tablet/netbook, and the game window no longer appears. I can run the program, and it instantly finished, and asks me to press any key to exit in the console. I did some research, and realized the version of SFML I was using didn't support ATI graphics cards, so I upgraded the program to 2.0 (it's essentially just a frame-work at the moment, so upgrading only took a couple hours, and I figured it wouldn't hurt even if it didn't fix everything).</p> <p>Unfortunately, it's still not appearing. When I run the program, the console appears, as it's supposed to, but the graphical/render window does not - instead, the text "Press any key to continue." is printed on the console, as if the program has already finished running. Pressing a key results in the program exiting with a return value of 0.</p> <p>The program is written in C++ using Codelite, and compiled using g++. I'm working from a Windows 8 Professional tablet/netbook at the moment, and while I can't test it until I have access to another computer, it was previously working fine, and I've no reason to believe it has stopped doing so outside the current environment. Any suggestions?</p> <p>[UPDATE]: Tried running it on another PC, windows 7, and got a new error about not being able to find the procedure entry point __gxx_personality_v0 in libstdc++-6.dll. The code, in its entirety, is far too large to post, but I don't think that's the problem, as it doesn't seem to even be getting into main().</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdio&gt; #include &lt;cassert&gt; #include "sfml.hpp" #include "angelscript.hpp" #include "MapGenerator.hpp" #include "TestState.hpp" #include "std.hpp" sf::RenderWindow* initialize(); void TestAngelScript(); void MessageCallback(const asSMessageInfo *msg, void *param); int main() { std::cout &lt;&lt; "Made it into main!!!" &lt;&lt; std::endl; TestAngelScript(); std::cout &lt;&lt; "Initializing" &lt;&lt; std::endl; sf::RenderWindow* App = initialize(); TextureHandler::Initialize(); FontHandler::Initialize(); SoundHandler::Initialize(); MusicHandler::Initialize(); InputHandler::Initialize(App); StateEngine engine; IState* state = new TestState(App); engine.AddState(state); sf::Clock clock; while (App-&gt;isOpen()) { sf::Event Event; while (App-&gt;pollEvent(Event)) { // Window closed if (Event.type == sf::Event::Closed) App-&gt;close(); // Escape key pressed if ((Event.type == sf::Event::KeyPressed) &amp;&amp; (Event.key.code == sf::Keyboard::Escape)) App-&gt;close(); } // Get elapsed time float ElapsedTime = clock.restart().asSeconds(); engine.Update(ElapsedTime); App-&gt;clear(); engine.Draw(App); App-&gt;display(); } return EXIT_SUCCESS; } sf::RenderWindow* initialize() { return new sf::RenderWindow(sf::VideoMode(800, 600, 32), "SFML Graphics"); } // Print the script string to the standard output stream void print(std::string &amp;msg) { printf("%s", msg.c_str()); } void TestAngelScript() { // Create the script engine asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); // Set the message callback to receive information on errors in human readable form. int r = engine-&gt;SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL); assert( r &gt;= 0 ); // AngelScript doesn't have a built-in string type, as there is no definite standard // string type for C++ applications. Every developer is free to register it's own string type. // The SDK do however provide a standard add-on for registering a string type, so it's not // necessary to implement the registration yourself if you don't want to. RegisterStdString(engine); // Register the function that we want the scripts to call r = engine-&gt;RegisterGlobalFunction("void print(const string &amp;in)", asFUNCTION(print), asCALL_CDECL); assert( r &gt;= 0 ); // The CScriptBuilder helper is an add-on that loads the file, // performs a pre-processing pass if necessary, and then tells // the engine to build a script module. CScriptBuilder builder; r = builder.StartNewModule(engine, "MyModule"); if( r &lt; 0 ) { // If the code fails here it is usually because there // is no more memory to allocate the module printf("Unrecoverable error while starting a new module.\n"); return; } r = builder.AddSectionFromFile("assets\\scripts\\test.as"); if( r &lt; 0 ) { // The builder wasn't able to load the file. Maybe the file // has been removed, or the wrong name was given, or some // preprocessing commands are incorrectly written. printf("Please correct the errors in the script and try again.\n"); return; } r = builder.BuildModule(); if( r &lt; 0 ) { // An error occurred. Instruct the script writer to fix the // compilation errors that were listed in the output stream. printf("Please correct the errors in the script and try again.\n"); return; } // Find the function that is to be called. asIScriptModule *mod = engine-&gt;GetModule("MyModule"); asIScriptFunction *func = mod-&gt;GetFunctionByDecl("void main()"); if( func == 0 ) { // The function couldn't be found. Instruct the script writer // to include the expected function in the script. printf("The script must have the function 'void main()'. Please add it and try again.\n"); return; } // Create our context, prepare it, and then execute asIScriptContext *ctx = engine-&gt;CreateContext(); ctx-&gt;Prepare(func); r = ctx-&gt;Execute(); if( r != asEXECUTION_FINISHED ) { // The execution didn't complete as expected. Determine what happened. if( r == asEXECUTION_EXCEPTION ) { // An exception occurred, let the script writer know what happened so it can be corrected. printf("An exception '%s' occurred. Please correct the code and try again.\n", ctx-&gt;GetExceptionString()); } } // Clean up ctx-&gt;Release(); engine-&gt;Release(); } // Implement a simple message callback function void MessageCallback(const asSMessageInfo *msg, void *param) { const char *type = "ERR "; if( msg-&gt;type == asMSGTYPE_WARNING ) type = "WARN"; else if( msg-&gt;type == asMSGTYPE_INFORMATION ) type = "INFO"; printf("%s (%d, %d) : %s : %s\n", msg-&gt;section, msg-&gt;row, msg-&gt;col, type, msg-&gt;message); } </code></pre> <p>Nothing is output to the console, save the prompt for input that comes after execution. Program returns 0.</p> <p>Running the program outside the IDE results in a couple errors about missing DLLs (libstdc++-6.dll and libgcc_s_sjlj_1.dll) Once those have been provided, I get the error about the missing procedure entry point... though on the netbook it complains about the same point missing in the SFML audio dll....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload