Visit Our UNIX and Linux User Community

Error while executing Directfb program on ubuntu

Thread Tools Search this Thread
Operating Systems Linux Error while executing Directfb program on ubuntu
# 1  
Old 09-10-2009
Error Error while executing Directfb program on ubuntu

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;
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.)

guide me how to compile this program..
any answer will appreciated.........

Previous Thread | Next Thread
Test Your Knowledge in Computers #740
Difficulty: Medium
FORTRAN II first appeared in 1958.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies

2. UNIX for Dummies Questions & Answers

executing a different program

What system calls or commands do I need to use in order to execute a different program from an already running process? (1 Reply)
Discussion started by: justOne21
1 Replies

3. Shell Programming and Scripting

Executing WIN32OLE program

Hello, Please help me out to execute this perl program: #!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... # get already active Excel application or open new my... (6 Replies)
Discussion started by: suvenduperl
6 Replies

4. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

5. Solaris

How to know the size of the program currently executing in memory

hey everybody, i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies

6. Programming

Trubble in executing the cpp program...

I wrote a code like this....... #include <iostream> #include <stdio.h> #include <mysql.h> #include <string.h> #include <stdlib.h> using namespace std; #include "Connection.h" int main() { char *Host = (char *)"localhost"; char *Database =(char *)"sachin"; char... (3 Replies)
Discussion started by: ps_sach
3 Replies

7. Programming

after executing execvp()... program hangs up

Hi , I m actually trying to implement pipes program,but after executing the execvp(),my program is getting hanged up :mad: Actaully i m getting the desired output expected from execvp()...but once results are displayed on the output screen ,program is getting hanged up values of... (3 Replies)
Discussion started by: Crab
3 Replies

8. Programming

Executing an .ec program in different informix versions

Hi all, I tried writing an .ec program connecting to informix database from solaris platform Sun 5.7 informix version that i had to used when i compiled the program was 9.21.UC3 the binary when i ported solaris box with informix version 9.40.UC5 i am unable to run that i am encountering... (0 Replies)
Discussion started by: matrixmadhan
0 Replies

9. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

10. Programming

executing a program within a program

Read the title: how do i do it? (4 Replies)
Discussion started by: Gekko
4 Replies

Featured Tech Videos