Undefined reference to...

Discussion in 'C++' started by Andre Janssen, Feb 6, 2006.

  1. Hi....

    I tried to compile the following src with this command: "g++ -Wall
    -o bla alsaswitch.cpp". The src is an example src of xosd package.

    #include <xosd.h>

    int main (int argc, char *argv[])
    {
    xosd *osd;

    osd = xosd_create (1);

    xosd_set_font(osd, "fixed");
    xosd_set_colour(osd, "LawnGreen");
    xosd_set_timeout(osd, 3);
    xosd_set_shadow_offset(osd, 1);

    xosd_display (osd, 0, XOSD_string, "Example XOSD output");

    xosd_wait_until_no_display(osd);

    xosd_uninit (osd);

    return 0;
    }

    this errors are shown - nothing is compiled

    /tmp/ccSqE3te.o: In function `main':
    alsaswitch.cpp:(.text+0x22): undefined reference to `xosd_create'
    alsaswitch.cpp:(.text+0x38): undefined reference to `xosd_set_font'
    alsaswitch.cpp:(.text+0x4b): undefined reference to `xosd_set_colour'
    alsaswitch.cpp:(.text+0x5b): undefined reference to `xosd_set_timeout'
    alsaswitch.cpp:(.text+0x6b): undefined reference to `xosd_set_shadow_offset'
    alsaswitch.cpp:(.text+0x7f): undefined reference to `xosd_display'
    alsaswitch.cpp:(.text+0x8d): undefined reference to `xosd_wait_until_no_display'
    alsaswitch.cpp:(.text+0x9b): undefined reference to `xosd_uninit'
    collect2: ld returned 1 exit status

    I am still to unexperienced to understand what sort of problem can cause
    these errors. So I would be glad if any one could help me out by giving me
    some hints.

    --
    MfG
    Andre Jan├čen
    Andre Janssen, Feb 6, 2006
    #1
    1. Advertising

  2. "Andre Janssen" <> wrote in
    message news:p...
    : I tried to compile the following src with this command: "g++ -Wall
    : -o bla alsaswitch.cpp". The src is an example src of xosd package.
    :
    : #include <xosd.h>
    :
    : int main (int argc, char *argv[])
    : {
    : xosd *osd;
    ....
    : this errors are shown - nothing is compiled
    :
    : /tmp/ccSqE3te.o: In function `main':
    : alsaswitch.cpp:(.text+0x22): undefined reference to `xosd_create'
    : alsaswitch.cpp:(.text+0x38): undefined reference to `xosd_set_font'
    ....
    : collect2: ld returned 1 exit status
    :
    : I am still to unexperienced to understand what sort of problem can cause
    : these errors. So I would be glad if any one could help me out by giving
    me
    : some hints.

    Note that the problem appears to be a linkage error,
    the compilation of the C++ code appearing to be successful.
    You need to specify a library (maybe xosd.a or .o ?) to be
    linked with your compiled file to have a complete application.

    As this is an implementation-specific question, best would
    be to post it in a forum dedicated to xosd or to your
    platform/compiler (gcc).

    hth -Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Brainbench MVP for C++ <> http://www.brainbench.com
    Ivan Vecerina, Feb 6, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Felipe
    Replies:
    3
    Views:
    444
    Felipe
    Jul 16, 2004
  2. Lu
    Replies:
    1
    Views:
    568
    Roel Schroeven
    Jul 10, 2003
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,750
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    590
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    368
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page