Undefined reference to...

A

Andre Janssen

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.
 
I

Ivan Vecerina

message : 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top