Uma espécie de resposta, não totalmente compilada, mas consegui resolver a parte em que o sdl.c não consegue compilar:
cc -c sdl.c 'sdl-config --cflags' 'pkg-config poppler-glib --cflags' 'pkg-config gtk+-2.0 --cflags' -o sdl.o
Eu esbarrei no verde , um visualizador de PDF para o Framebuffer. Eu gostaria de compilá-lo, mas não estou tendo muito sucesso, apesar de ter instalado todas as dependências ...
O erro que estou recebendo é:
$/home/Data/Software/green-0.2$ make
cc -D GREEN_SYSCONFIG_FILE=\"/usr/local/etc/green.conf\" -D GREEN_USERCONFIG_FILE=\".green.conf\" -Os -Wall -c main.c $(pkg-config poppler-glib --cflags) -o main.o
cc -Os -Wall -c green.c $(pkg-config poppler-glib --cflags) -o green.o
cc -Os -Wall -c sdl.c $(pkg-config poppler-glib --cflags) $(sdl-config --cflags) -o sdl.o
sdl.c: In function ‘GetInput’:
sdl.c:91:3: warning: case value ‘37’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:85:3: warning: case value ‘123’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:86:3: warning: case value ‘125’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:94:3: warning: case value ‘126’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:90:3: warning: case value ‘4294967207’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c: In function ‘RenderPage’:
sdl.c:120:2: error: unknown type name ‘GdkPixbuf’
sdl.c:120:2: warning: implicit declaration of function ‘gdk_pixbuf_new’ [-Wimplicit-function-declaration]
sdl.c:120:34: error: ‘GDK_COLORSPACE_RGB’ undeclared (first use in this function)
sdl.c:120:34: note: each undeclared identifier is reported only once for each function it appears in
sdl.c:136:2: warning: implicit declaration of function ‘poppler_page_render_to_pixbuf’ [-Wimplicit-function-declaration]
sdl.c:137:2: warning: implicit declaration of function ‘gdk_pixbuf_get_pixels’ [-Wimplicit-function-declaration]
sdl.c:137:9: warning: assignment makes pointer from integer without a cast [enabled by default]
sdl.c:138:2: warning: implicit declaration of function ‘gdk_pixbuf_get_rowstride’ [-Wimplicit-function-declaration]
sdl.c:139:2: warning: implicit declaration of function ‘gdk_pixbuf_get_n_channels’ [-Wimplicit-function-declaration]
sdl.c: In function ‘Green_SDL_Main’:
sdl.c:402:21: warning: variable ‘left_y’ set but not used [-Wunused-but-set-variable]
sdl.c:402:9: warning: variable ‘left_x’ set but not used [-Wunused-but-set-variable]
make: *** [sdl.o] Error 1
$:/home/Data/Software/green-0.2$
Obviamente, ele não consegue encontrar GdkPixbuf, mas esta construção é definida em:
# ls /usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h
/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h
Quando eu adiciono ao arquivo sdl.c a seguinte linha:
#include <gdk-pixbuf/gdk-pixbuf.h>
Eu sou "saudado" com o seguinte erro:
# make
cc -Os -Wall -c sdl.c $(pkg-config poppler-glib --cflags) $(sdl-config --cflags) -o sdl.o
sdl.c:20:35: fatal error: gdk-pixbuf/gdk-pixbuf.h: No such file or directory
compilation terminated.
make: *** [sdl.o] Error 1
A minha pergunta é, então, como convencer o gcc a compilar este código?
Obrigado antecipadamente, Oz
ATUALIZAÇÃO:
com:
#include "/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h"
#include "/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-core.h"
#include "/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-features.h"
#include "/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h"
adicionado ao sdl.c
Estou recebendo os seguintes erros:
:/home/Data/Software/green-0.2$ make
cc -D GREEN_SYSCONFIG_FILE=\"/usr/local/etc/green.conf\" -D GREEN_USERCONFIG_FILE=\".green.conf\" -Os -Wall -c main.c $(pkg-config poppler-glib --cflags) $(pkg-config gtk+-2.0 --cflags) -o main.o
cc -Os -Wall -c green.c $(pkg-config poppler-glib --cflags) $(pkg-config gtk+-2.0 --cflags) -o green.o
cc -Os -Wall -c sdl.c $(pkg-config poppler-glib --cflags) $(sdl-config --cflags) $(pkg-config gtk+-2.0 --cflags) -o sdl.o
sdl.c: In function ‘GetInput’:
sdl.c:101:3: warning: case value ‘37’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:95:3: warning: case value ‘123’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:96:3: warning: case value ‘125’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:104:3: warning: case value ‘126’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c:100:3: warning: case value ‘4294967207’ not in enumerated type ‘SDLKey’ [-Wswitch]
sdl.c: In function ‘RenderPage’:
sdl.c:146:2: warning: implicit declaration of function ‘poppler_page_render_to_pixbuf’ [-Wimplicit-function-declaration]
sdl.c: In function ‘Green_SDL_Main’:
sdl.c:412:21: warning: variable ‘left_y’ set but not used [-Wunused-but-set-variable]
sdl.c:412:9: warning: variable ‘left_x’ set but not used [-Wunused-but-set-variable]
cc main.o green.o sdl.o $(pkg-config poppler-glib --libs) $(sdl-config --libs) $(pkg-config gtk+-2.0 --cflags) -o green
sdl.o: In function 'RenderPage':
sdl.c:(.text+0x23c): undefined reference to 'gdk_pixbuf_new'
sdl.c:(.text+0x283): undefined reference to 'poppler_page_render_to_pixbuf'
sdl.c:(.text+0x28b): undefined reference to 'gdk_pixbuf_get_pixels'
sdl.c:(.text+0x298): undefined reference to 'gdk_pixbuf_get_rowstride'
sdl.c:(.text+0x2a4): undefined reference to 'gdk_pixbuf_get_n_channels'
collect2: ld returned 1 exit status
make: *** [green] Error 1
Meu palpite é que existe alguma flag do gcc que eu estou perdendo? ou ligando?
Uma espécie de resposta, não totalmente compilada, mas consegui resolver a parte em que o sdl.c não consegue compilar:
cc -c sdl.c 'sdl-config --cflags' 'pkg-config poppler-glib --cflags' 'pkg-config gtk+-2.0 --cflags' -o sdl.o