simple program with svgalib = no compile?

This is a discussion on simple program with svgalib = no compile? within the C++ Programming forums, part of the General Programming Boards category; why dose this no compile? Code: #include <stdlib.h> #include <vga.h> int main(void) { vga_init(); vga_setmode(G320x200x256); vga_setcolor(4); vga_drawpixel(10, 10); vga_setmode(TEXT); return ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    29

    simple program with svgalib = no compile?

    why dose this no compile?

    Code:
    #include <stdlib.h>
    #include <vga.h>
     
    int main(void)
    {
       vga_init();
       vga_setmode(G320x200x256);
       vga_setcolor(4);
       vga_drawpixel(10, 10);
     
       vga_setmode(TEXT);
    
       return EXIT_SUCCESS;
    }
    here is the output:
    make all-recursive
    Making all in src
    mv -f .deps/svglib.Tpo .deps/svglib.Po
    /bin/bash ../libtool --tag=CXX --mode=link g++ -O0 -g3 -o svglib svglib.o
    g++ -O0 -g3 -o svglib svglib.o
    svglib.o: In function `main':
    6: undefined reference to `vga_init'
    :7: undefined reference to `vga_setmode'
    :8: undefined reference to `vga_setcolor'
    :9: undefined reference to `vga_drawpixel'
    :11: undefined reference to `vga_setmode'
    collect2: ld returned 1 exit status
    make[2]: *** [svglib] Error 1
    make[2]: Target not remade because of errors.
    make[2]: Nothing to be done for `all-am'.
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    *** Exited with status: 2 ***

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, you need to link with the svgalib. add -lvga to your compile line.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with simple, simple program.
    By LightsOut06 in forum C Programming
    Replies: 5
    Last Post: 09-01-2005, 09:31 PM
  2. Problem with simple XOR program
    By spike_ in forum C++ Programming
    Replies: 8
    Last Post: 08-17-2005, 01:09 AM
  3. simple frontend program problem
    By gandalf_bar in forum Linux Programming
    Replies: 16
    Last Post: 04-22-2004, 07:33 AM
  4. How To Embed Data In Program While Compile?
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 09-09-2002, 11:14 AM
  5. how do i compile a program that deals w/classes?
    By Shy_girl_311 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2001, 02:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21