Author Topic: Code::blocks, Ubuntu and Clanlib  (Read 4764 times)

gmatt

  • Guest
Code::blocks, Ubuntu and Clanlib
« on: July 05, 2007, 08:47:38 am »
Hello,

I've been slamming my head against the wall because I have been trying to get Clanlib to work for a long time with code::blocks. Needless to say, it is not successful. I still can't figure out how to run the simple test program
Code
#include <ClanLib/gl.h>
#include <ClanLib/core.h>
#include <ClanLib/application.h>
#include <ClanLib/display.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;


using code:blocks. I can get it to compile, but to run it, it is hell...

It uses the command

Code
 xterm -e'LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH /usr/bin/cb_console_runner "/home/matt/game/Anything/bin/Debug/Anything" ' 
to run the program, but then it gives the error
Code
 error while loading shared libraries: libclanSignals-0.8.so.1: cannot open shared object file: No such file or directory
. I've tried running the binary by itself by cd into the bin directory and calling it directly making sure that /usr/local/lib is in LD_LIBRARY_PATH and I can't do it either, it says
Code
You need a create a display target first.
whereas when I compile it myself and run it it runs fine!

this is very very very frustrating please any help is appreciated, especially if you got stuff to compile and run with code::blocks

gmatt

  • Guest
Re: Code::blocks, Ubuntu and Clanlib
« Reply #1 on: July 05, 2007, 10:57:28 am »
I gave up on code::blocks, too bugy. Thanks for the product but I ended up using KDevelop.