Results 1 to 3 of 3

Thread: Problems with Skeleton Program

  1. #1

    Default Problems with Skeleton Program

    I was installing ClanLib 0.8 on my WinXP box and wanted to make sure it worked. So I opened VS 7.0, put in the sample code that's in the INSTALL.win32 file, compiled it, and ran it. All was well until I hit escape to close the window, then I got a stack overflow and an access violation error!

    Here's the code I used:
    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
    #include <ClanLib/display.h>
    #include <ClanLib/gl.h>
    
    class MyApp : public CL_ClanApplication
    {
    public:
    	virtual int main(int argc, char **argv)
    	{
    		// Create a console window for text-output if not available
    		// Use printf or cout to display some text in your program
    		CL_ConsoleWindow console("Console");
    		console.redirect_stdio();
    
    		try
    		{
    			// Initialize ClanLib base components
    			CL_SetupCore setup_core;
    
    			// Initialize the ClanLib display component
    			CL_SetupDisplay setup_display;
    
    			// Initialize the ClanLib GL component
    			CL_SetupGL setup_gl;
    
    			// Create a display window
    			CL_DisplayWindow window("ClanLib application", 640, 480);
    
    			// Run until someone presses escape
    			while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
    			{
    				// Clear the display in a dark blue nuance
    				// The four arguments are red, green, blue and alpha (defaults to 255)
    				// All color nuances in ClanLib are measured in the interval 0->255
    				CL_Display::clear(CL_Color(0, 0, 50));
    
    				// Flip the display (using a double-buffer),
    				// showing on the screen what we have drawed
    				// since last call to flip()
    				CL_Display::flip();
    
    				// This call updates input and performs other "housekeeping"
    				// Call this each frame
    				// Also, gives the CPU a rest for 10 milliseconds to catch up
    				CL_System::keep_alive(10);
    			}
    		}
    		// Catch any errors from ClanLib
    		catch (CL_Error err)
    		{
    			// Display the error message
    			std::cout << err.message.c_str() << std::endl;
    		}
    
    		// Display console close message and wait for a key
    		console.display_close_message();
    
    		return 0;
    	}
    } app;
    I think there error is occuring at this line:
    Code:
    // Display console close message and wait for a key
    console.display_close_message();
    Is there something I did/didn't do that may be causing this error?

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Hi SFX,

    This is probably because you are linking with a single threaded LIBC.

    You can change to "Multi-threaded Debug" or "Multi-threaded" in Project->Properties->Configuration Properties->C/C++->Code Generation. (look for the "runtime library" option.

    I cut and pasted this to replace the code in the "ExampleInitDisplay" example and it ran fine.
    Seth A. Robinson
    Robinson Technologies

  3. #3

    Default

    Thanks, you just solved all my problems.

Similar Threads

  1. Installer program
    By in forum RTsoft Tavern
    Replies: 4
    Last Post: 08-02-2005, 10:37 PM
  2. Mog freezup problems
    By in forum Dink Smallwood HD
    Replies: 1
    Last Post: 10-05-2004, 07:50 PM
  3. Strange problems
    By File Sponge in forum Funeral Quest
    Replies: 4
    Last Post: 08-29-2004, 07:16 AM
  4. what program they used to make dink smallwood
    By woody in forum Dink Smallwood HD
    Replies: 3
    Last Post: 07-03-2003, 10:03 PM
  5. what program they used to make dink smallwood
    By woody in forum Dink Smallwood HD
    Replies: 0
    Last Post: 07-03-2003, 02:32 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •