title: How to execute this DirectFB sample?
body: <p>I got the following directFB example code form the <a href="http://directfb.org/docs/DirectFB_Tutorials/" rel="nofollow">tutorials</a>:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  
  #include &lt;directfb/directfb.h&gt;
  
  static IDirectFB *dfb = NULL;
  static IDirectFBSurface *primary = NULL;
  static int screen_width = 0;
  static int screen_height = 0;
  #define DFBCHECK(x...)                                         \
    {                                                            \
      DFBResult err = x;                                         \
                                                                 \
      if (err != DFB_OK)                                         \
        {                                                        \
          fprintf( stderr, "%s &lt;%d&gt;:\n\t", __FILE__, __LINE__ ); \
          DirectFBErrorFatal( #x, err );                         \
        }                                                        \
    }
  int main(int argc, char **argv) {
  
      DFBSurfaceDescription dsc;
      DFBCHECK(DirectFBInit (&amp;argc, &amp;argv));
      DFBCHECK(DirectFBCreate (&amp;dfb));
      DFBCHECK(dfb-&gt;SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
      dsc.flags = DSDESC_CAPS;
      dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
      DFBCHECK(dfb-&gt;CreateSurface( dfb, &amp;dsc, &amp;primary ));
      DFBCHECK(primary-&gt;GetSize (primary, &amp;screen_width, &amp;screen_height));
      DFBCHECK(primary-&gt;FillRectangle (primary, 0, 0, screen_width, screen_height));
      DFBCHECK(primary-&gt;SetColor (primary, 0x80, 0x80, 0xff, 0xff));
      DFBCHECK(primary-&gt;DrawLine (primary, 0, screen_height / 2, screen_width - 1, screen_height / 2));
      DFBCHECK(primary-&gt;Flip (primary, NULL, 0));
      sleep(5);
      primary-&gt;Release(primary);
      dfb-&gt;Release(dfb);
      return 23;
  }
  </code></pre>
  
  <p>And I'm trying to compile and got the error (from a gnome-terminal):</p>
  
  <pre><code>$ g++ Test01HorizontalLine.cpp -I /usr/local/include/directfb/
  Test01HorizontalLine.cpp: In function ‘int main(int, char**)’:
  Test01HorizontalLine.cpp:27: error: invalid conversion from ‘int’ to ‘DFBSurfaceCapabilities’
  Test01HorizontalLine.cpp:33: error: invalid conversion from ‘int’ to ‘DFBSurfaceFlipFlags’
  </code></pre>
  
  <p>I'm using DFB 1.4.11 (I can't update for my current project). How can I make this sample run? (newbie)</p>
  
  <p><strong>--update</strong></p>
  
  <p>After update the lines (as stated by @jclin):</p>
  
  <pre><code>dsc.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_FLIPPING);  
  ...  
  primary-&gt;Flip(primary, NULL, DFBSurfaceFlipFlags(0));  
  </code></pre>
  
  <p>the result is:</p>
  
  <pre><code>$ g++ Test01HorizontalLine.cpp -I /usr/local/include/directfb/
  /tmp/cc6iUS1W.o: In function `main':
  Test01HorizontalLine.cpp:(.text+0x1c): undefined reference to `DirectFBInit'
  Test01HorizontalLine.cpp:(.text+0x61): undefined reference to `DirectFBErrorFatal'
  Test01HorizontalLine.cpp:(.text+0x6d): undefined reference to `DirectFBCreate'
  Test01HorizontalLine.cpp:(.text+0xb2): undefined reference to `DirectFBErrorFatal'
  Test01HorizontalLine.cpp:(.text+0x111): undefined reference to `DirectFBErrorFatal'
  Test01HorizontalLine.cpp:(.text+0x188): undefined reference to `DirectFBErrorFatal'
  Test01HorizontalLine.cpp:(.text+0x1ef): undefined reference to `DirectFBErrorFatal'
  Test01HorizontalLine.cpp:(.text+0x26d): undefined reference to `DirectFBErrorFatal'
  /tmp/cc6iUS1W.o:Test01HorizontalLine.cpp:(.text+0x2e4): more undefined references to `DirectFBErrorFatal' follow
  collect2: ld returned 1 exit status
  </code></pre>