Results 1 to 2 of 2

Thread: CL_Draw::gradient_fill problem!

  1. #1

    Unhappy CL_Draw::gradient_fill problem!

    tutorial in http://codegrind.net/2010/09/30/clan...art-2-visuals/

    CL_Colorf red(155/255.0f, 60/255.0f, 68/255.0f);
    // Draw top of sunset
    CL_Gradient gradient1(CL_Colorf::black, red);
    CL_Draw::gradient_fill(gc, CL_Rectf(0,0,640,160), gradient1);

    when compile:
    make all
    Building file: ../src/main.cpp
    Invoking: GCC C++ Compiler
    g++ -I/usr/include/ClanLib-2.2 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -o"src/main.o" "../src/main.cpp"
    ../src/main.cpp: In member function ‘void ConsoleProgram::draw(const CL_GraphicContext&)’:
    ../src/main.cpp:46:64: error: no matching function for call to ‘CL_Draw::gradient_fill(const CL_GraphicContext&, CL_Rectf, CL_Gradient&)’
    /usr/include/ClanLib-2.2/ClanLib/Display/2D/draw.h:153:14: note: candidates are: static void CL_Draw::gradient_fill(CL_GraphicContext&, float, float, float, float, const CL_Gradient&)
    /usr/include/ClanLib-2.2/ClanLib/Display/2D/draw.h:161:14: note: static void CL_Draw::gradient_fill(CL_GraphicContext&, const CL_Pointf&, const CL_Pointf&, const CL_Gradient&)
    /usr/include/ClanLib-2.2/ClanLib/Display/2D/draw.h:168:14: note: static void CL_Draw::gradient_fill(CL_GraphicContext&, const CL_Rectf&, const CL_Gradient&)
    ../src/main.cpp: In static member function ‘static int ConsoleProgram::main(const std::vector<CL_String8>&)’:
    make: *** [src/main.o] error 1

    tell me why,thanks!

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

    Default

    That is a puzzling question.

    It works here, using GCC on Ubuntu and Visual Studio on windows.

    I tried your code, inserting into the Basic2D example main loop.


    gcc --version
    gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -msse2 -I/usr/include/ClanLib-2.2 -pthread -c Sources/basic2d.cpp -o Sources/basic2d.o

    It compiles.

    Normally that type of error is caused by doing the following:
    Code:
    void myfunc( MyStruct &abc ) {...}
    myfunc( MyStruct(...) );
    Where GCC requires:
    Code:
    void myfunc( const MyStruct &abc ) {...}
    myfunc( MyStruct(...) );
    or
    Code:
    void myfunc( MyStruct &abc ) {...}
    
    MyStruct abc(...);
    myfunc( abc );

Similar Threads

  1. how to detect the outline of a drawing drawn by CL_Draw?
    By jckhoa in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-16-2010, 09:24 AM
  2. CL_Draw question
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 07-08-2009, 05:11 PM
  3. About CL_Draw question?
    By Eng C. Born in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-14-2009, 09:38 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
  •