mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] makefile to directFB and cairo
@ 2015-04-23  9:18 Alejandro Vázquez
  2015-05-05 22:14 ` Alejandro Vázquez
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Vázquez @ 2015-04-23  9:18 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 779 bytes --]

Hi!,
i am trying the compile of a example for the library directFB and other for
library cairo. I have isntall the libraries directFB and Cairo.
The first step: i create a new package type "src-make-prog".
2: copy the example "hello world" in the new file "helloworld*.c"
3: I modify the Makefile file  and i  add:
CFLAGS   = -g -Wall -O2 -MD `pkg-config --cflags directfb`
LDFLAGS  = -g -Wall -O2 `pkg-config --libs directfb`

for cairo is the same but the flags are:
CFLAGS   = -g -Wall -O2 -MD `pkg-config --cflags cairo`
LDFLAGS  = -g -Wall -O2 `pkg-config --libs cairo`

In both cases, the compiler say me:
undefined reference to `DirectFBInit', etc...
undefined reference to `cairo_image_surface_create',etc...

Am I doing it the right way or I need something more to add?

[-- Attachment #1.2: Type: text/html, Size: 1045 bytes --]

[-- Attachment #2: helloworlddf.c --]
[-- Type: text/x-csrc, Size: 1614 bytes --]

#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)
{
  DFBSurfaceDescription dsc;

  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 (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));

  DFBCHECK (primary->SetColor (primary, 0x80, 0x80, 0xff, 0xff));
  DFBCHECK (primary->DrawLine (primary,
			                      0, screen_height / 2,
			       screen_width - 1, screen_height / 2));
  DFBCHECK (primary->Flip (primary, NULL, 0));

  sleep (5);

  primary->Release( primary );
  dfb->Release( dfb );

  return 23;
}

[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 387 bytes --]

#
# Simple development makefile
#

#
# add more flags here,
# but don't remove the "+="
#
CFLAGS += -O2 -g -Wall -MD `pkg-config --cflags directfb`#-Wsign-compare -Wfloat-equal -Wformat-security #-Werror
CPPFLAGS +=
LDFLAGS += -g -Wall -O2 `pkg-config --libs directfb`


all: helloworlddf

clean:
	-rm -f helloworlddf

install:


.PHONY: all install clean

# end of development makefile

[-- Attachment #4: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] makefile to directFB and cairo
  2015-04-23  9:18 [ptxdist] makefile to directFB and cairo Alejandro Vázquez
@ 2015-05-05 22:14 ` Alejandro Vázquez
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Vázquez @ 2015-05-05 22:14 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 1102 bytes --]

Hi!
I can solve the problem. i add in the makefile the next code:
examplecairo:examplecairo.c
$(CC) $^ -Wall `pkg-config --cflags --libs cairo directfb` -o $@

this way compile correctly


2015-04-23 11:18 GMT+02:00 Alejandro Vázquez <vazlup@gmail.com>:

> Hi!,
> i am trying the compile of a example for the library directFB and other
> for library cairo. I have isntall the libraries directFB and Cairo.
> The first step: i create a new package type "src-make-prog".
> 2: copy the example "hello world" in the new file "helloworld*.c"
> 3: I modify the Makefile file  and i  add:
> CFLAGS   = -g -Wall -O2 -MD `pkg-config --cflags directfb`
> LDFLAGS  = -g -Wall -O2 `pkg-config --libs directfb`
>
> for cairo is the same but the flags are:
> CFLAGS   = -g -Wall -O2 -MD `pkg-config --cflags cairo`
> LDFLAGS  = -g -Wall -O2 `pkg-config --libs cairo`
>
> In both cases, the compiler say me:
> undefined reference to `DirectFBInit', etc...
> undefined reference to `cairo_image_surface_create',etc...
>
> Am I doing it the right way or I need something more to add?
>
>

[-- Attachment #1.2: Type: text/html, Size: 1718 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23  9:18 [ptxdist] makefile to directFB and cairo Alejandro Vázquez
2015-05-05 22:14 ` Alejandro Vázquez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox