Rasp333
Posts: 5
Joined: Tue Jul 03, 2012 7:36 am

How to use SVGAlib ?

Sun Jul 08, 2012 9:04 am

Hello,

I'm new users of Arch, and I know a bit linux system.
I would like to make graphics without using X server.
So I found I could use SVGAlib.

I tried that code snippet :

Code: Select all

 #include <stdio.h>
 #include <stdlib.h>
 #include <vga.h>

 int main(void)
 {
    vga_init();
    vga_setmode(1);
    vga_setcolor(14);
    vga_setmode(TEXT); //retourner au mode texte (important)
    return EXIT_SUCCESS;
 }
using thise Makefile :

Code: Select all

prog:	main.o
	gcc -o prog main.o -lvga

main.o:	main.c
	gcc -o main.o -c main.c -W -Wall -ansi -pedantic -I/usr/src/linux-3.1.10-11-ARCH/include/video/ -I/usr/src/linux-3.1.10-11-ARCH/arch/arm/include/ -I/usr/src/linux-3.1.10-11-ARCH/include/linux/
When I first compiled, path was not found, this is why I added pathes in gcc command.

but now, I'm stopped on this error and I don't know how to correct it :

Code: Select all

[root@alarmpi code]# make
gcc -o main.o -c main.c -W -Wall -ansi -pedantic -I/usr/src/linux-3.1.10-11-ARCH/include/video/ -I/usr/src/linux-3.1.10-11-ARCH/arch/arm/include/ -I/usr/src/linux-3.1.10-11-ARCH/include/linux/
In file included from /usr/include/stdio.h:34:0,
                 from main.c:1:
/usr/src/linux-3.1.10-11-ARCH/include/linux/stddef.h:4:28: fatal error: linux/compiler.h: No such file or directory
compilation terminated.
make: *** [main.o] Error 1
Of course, linux/compiler exists here : /usr/src/linux-3.1.10-11-ARCH/include/linux/compiler.h
but gcc can't find it though I gave it the path.

Please, if any could give me a help.

pepedog
Posts: 1043
Joined: Fri Oct 07, 2011 9:55 am

Re: How to use SVGAlib ?

Sun Jul 08, 2012 10:55 am

Is the package linux-api-headers installed?

Rasp333
Posts: 5
Joined: Tue Jul 03, 2012 7:36 am

Re: How to use SVGAlib ?

Mon Jul 09, 2012 7:36 am

I had installed pacman -S linux-headers.
I have installed linux-api-headers too now, but I still have the same error :

Code: Select all

[root@alarmpi code]# make
gcc -o main.o -c main.c -W -Wall -ansi -pedantic -I/usr/src/linux-3.1.10-11-ARCH/include/video/ -I/usr/src/linux-3.1.10-11-ARCH/arch/arm/include/ -I/usr/src/linux-3.1.10-11-ARCH/include/linux/
In file included from /usr/include/stdio.h:34:0,
                 from main.c:1:
/usr/src/linux-3.1.10-11-ARCH/include/linux/stddef.h:4:28: fatal error: linux/compiler.h: No such file or directory
compilation terminated.
make: *** [main.o] Error 1
As you can see, compiler.h is in the path I added to gcc (/usr/src/linux-3.1.10-11-ARCH/include/linux/) :

Code: Select all

[root@alarmpi code]# find / -name compiler.h
/usr/src/linux-3.1.10-11-ARCH/include/linux/compiler.h

Return to “Arch”