Results 1 to 2 of 2

Thread: Problem linking ClanLib

  1. #1

    Default Problem linking ClanLib

    Hi,

    I am trying to build the simple Hello World! programs from the getting started pages, but I am having some problems.
    I can build the Console Hello World! program without any problems and it runs fine, but the Display version won't link. The errors make it look like there was an API change between the current version and the one used in the examples, but I don't think that is actually the problem.
    Example error:
    Code:
    main.cpp:16:38: error: no matching function for call to ‘clan::Canvas::Canvas(clan::GraphicContext&)’
             Canvas canvas(window.get_gc());
    main.cpp:16:38: note: candidates are:
             explicit Canvas(DisplayWindow &window);
    At first, I just downloaded ClanLib 3.0 from the Arch repositories, and it was installed system-wise. When I hit this problem I just got the source code from this page and built it myself, same problem.

    I am using ClanLib v3.0.1 under a x64 Arch Linux environment.

    Here is a complete pastebin of the errors:
    http://pastebin.com/byHSVXfQ

    This is my makefile (it works for the Console version, but doesn't for the Display one).
    Code:
    PACKAGES = clanCore-3.0 clanDisplay-3.0 clanApp-3.0 clanGL-3.0
    LIBS = `pkg-config --cflags --libs $(PACKAGES)`
    OBJS = main.o
    CXXFLAGS=-I"/usr/local/include/ClanLib-3.0" -std=c++11
    
    all: $(OBJS)
    	g++ -o main -pthread $(OBJS) $(LIBS)
    
    clean:
    	-rm -rf *.o
    	-rm main
    This is the code I'm trying to build:
    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/display.h>
    #include <ClanLib/gl.h>
    #include <ClanLib/application.h>
    
    using namespace clan;
    
    class DisplayProgram {
    public:
        static int main(const std::vector<std::string> &args) {
            SetupCore setup_core;
            SetupDisplay setup_display;
            SetupGL setup_gl;
    
            DisplayWindow window("Hello World", 640, 480);
            Canvas canvas(window.get_gc());
            InputDevice keyboard = window.get_ic().get_keyboard();
            clan::Font font(canvas, "Tahoma", 30); // The clan prefix is required on linux due to a namespace conflict
    
            while (!keyboard.get_keycode(keycode_escape)) {
                canvas.clear(Colorf::cadetblue);
                Draw::line(canvas, 0, 110, 640, 110, Colorf::yellow);
                font.draw_text(canvas, 100, 100, "Hello World!", Colorf::lightseagreen);
                canvas.flush();
                window.flip();
                KeepAlive::process();
            }
    
            return 0;
        }
    };
    
    Application app(&DisplayProgram::main);

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    It looks like the "Getting Started" documentation page is out of date.
    Code:
    	{
    		using namespace clan;
    		DisplayWindow window("Hello World", 640, 480);
    		Canvas canvas(window);
    		InputDevice keyboard = window.get_ic().get_keyboard();
    		clan::Font font(canvas, "Tahoma", 30); // The clan prefix is required on linux due to a namespace conflict
    
    		while (!keyboard.get_keycode(keycode_escape)) {
    			canvas.clear(Colorf::cadetblue);
    			canvas.draw_line(0, 110, 640, 110, Colorf::yellow);
    			font.draw_text(canvas, 100, 100, "Hello World!", Colorf::lightseagreen);
    			canvas.flush();
    			window.flip();
    			KeepAlive::process();
    		}
    	}
    Changes were: "Canvas canvas(window);"
    and "canvas.draw_line(0, 110, 640, 110, Colorf::yellow);"

Similar Threads

  1. Door Linking Problem
    By SmellKille1 in forum Bugs & Glitches
    Replies: 5
    Last Post: 07-28-2013, 11:04 AM
  2. A wierd problem (ClanLib 2.3 SVN), GRR!
    By user in forum Official ClanLib SDK Forums
    Replies: 13
    Last Post: 11-28-2011, 06:38 PM
  3. Problem installing ClanLib
    By sebastian in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 11-14-2010, 08:22 AM
  4. Problem linking Sqlite in vs9
    By vladimirdlc in forum Official ClanLib SDK Forums
    Replies: 9
    Last Post: 07-14-2009, 05:46 PM
  5. Linking Problem With MS Visual C++
    By daredevil14 in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 07-27-2008, 11:44 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
  •