Problems in compiling a static binary


I have to compile a static binary.
If the program is something like:---------------------------------
#include <stdio.h>
void main()

with “g++ dummy.cpp -static” I have no problems… but the program I
have to compile uses libraries such as “vga.h”, “vgagl.h” and
when I try to compile it with something like
"g++ dummy.cpp -lvga -lvgagl -static"

I receive a lot of error messages:

/usr/lib/libvga.a(vga.o): In function __svgalib_open_devconsole': vga.o(.text+0x5d7): undefined reference toIO_stdin
vga.o(.text+0x5e1): undefined reference to _IO_stdout_' vga.o(.text+0x5eb): undefined reference toIO_stderr
vga.o(.text+0x631): undefined reference to _IO_stderr_' vga.o(.text+0x644): undefined reference toIO_stderr
/usr/lib/libvga.a(vga.o): In function __svgalib_getchipset': vga.o(.text+0xe06): undefined reference toIO_stderr
/usr/lib/libvga.a(vga.o): In function __svgalib_read_options': vga.o(.text+0x331b): undefined reference toIO_stderr
/usr/lib/libvga.a(vga.o)(.text+0x33e7): more undefined references to _IO_stderr_' follow /usr/lib/libvga.a(vgamisc.o): In functionvga_getkey’:
vgamisc.o(.text+0x50a): undefined reference to _IO_stdin_' vgamisc.o(.text+0x57e): undefined reference toIO_stdin

and much more!
does anybody can help me?


In general, please direct unrelated messages to the appropriate support
forum. This is appropriate for a general Linux development mailing list.

-Sam Lantinga (slouken at

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec