Hi ,
I am getting error while executing Directfb program on ubuntu ,,
my program is :
#include <stdio.h>
#include <unistd.h>
#include <directfb.h>
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 <%d>:\\n\\t", \_\_FILE__, \_\_LINE__ \);
DirectFBErrorFatal\( \#x, err \);
\}
}
int main (int argc, char **argv)
{
int i;
DFBSurfaceDescription dsc;
IDirectFBImageProvider *provider;
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
DFBCHECK (dfb->CreateImageProvider (dfb, DATADIR"/dfblogo.png", &provider));
DFBCHECK (provider->GetSurfaceDescription (provider, &dsc));
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &logo ));
DFBCHECK (provider->RenderTo (provider, logo, NULL));
provider->Release (provider);
for (i = -dsc.width; i < screen_width; i++)
{
DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
DFBCHECK (primary->Blit (primary, logo, NULL, i, (screen_height - dsc.height) / 2));
DFBCHECK \(primary->Flip \(primary, NULL, DSFLIP_WAITFORSYNC\)\);
\}
logo->Release (logo);
primary->Release (primary);
dfb->Release (dfb);
return 23;
}
im compiling this program by
root@lxdevenv:~/Desktop# gcc a.c -o a -I/usr/local/include/directfb -L/usr/local/include/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU
i am getting the following Error as below
root@lxdevenv:~/Desktop# gcc a.c -o a -I/usr/local/include/directfb -L/usr/local/include/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU
a.c:15: error: expected identifier or �(' before �{' token
a.c:21: error: stray �#' in program
a.c: In function �main':
a.c:39: error: expected �;' before �dsc'
a.c:58: error: �logo' undeclared (first use in this function)
a.c:58: error: (Each undeclared identifier is reported only once
a.c:58: error: for each function it appears in.)
root@lxdevenv:~/Desktop#
guide me how to compile this program..
any answer will appreciated.........