Hi,

Firstly I'd like to note that I'm not new to programming, but am new to xmms2, new to C, and new to Eclipse, so please forgive my newbie question.

I'm trying to work through the xmms2 client tutorials, and although I can read through the code and understand at a high level what it's doing, I am stuck on trying to get the first tutorial to compile :(

I'm using eclipse CDT, and am fairly certain that it's a problem with the way I have (or have not) set the include environment.

This is the console output when I try to compile:

**** Build of configuration Release for project mplay ****

make -k all
Building file: ../src/tut1.c
Invoking: GCC C Compiler
gcc -I/usr/include/xmms2 -O3 -Wall -c -fmessage-length=0 `pkg-config --libs xmms2-client` -MMD -MP -MF"src/tut1.d" -MT"src/tut1.d" -o"src/tut1.o" "../src/tut1.c"
../src/tut1.c: In function ‘main’:
../src/tut1.c:47: error: ‘xmmsv_t’ undeclared (first use in this function)
../src/tut1.c:47: error: (Each undeclared identifier is reported only once
../src/tut1.c:47: error: for each function it appears in.)
../src/tut1.c:47: error: ‘return_value’ undeclared (first use in this function) ../src/tut1.c:114: warning: implicit declaration of function ‘xmmsc_result_get_value’ ../src/tut1.c:120: warning: implicit declaration of function ‘xmmsv_is_error’ ../src/tut1.c:121: warning: implicit declaration of function ‘xmmsv_get_error’
make: *** [src/tut1.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project mplay

Any help gratefully received.

Thanks

Ailwyn

PS I have also tried using the makefile that comes with the tutorial, but same issue. Perhaps I need to specifically add something to the OS PATH?

---------------------------------------------------

OS - Ubuntu Jaunty 9.04
Eclipse 3.5
Packages: xmms2, xmms2-dev, libxmmsclient-dev - all version 0.5DrLecter-2ubuntu3

---------------------------------------------------

code for tut1.c
/* XMMS2 - X Music Multiplexer System
* Copyright (C) 2003-2006 XMMS2 Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* This file is a part of the XMMS2 client tutorial #1
*/

#include <stdlib.h>

/* include xmmsclient header */
#include <xmmsclient/xmmsclient.h>

int
main (int argc, char **argv)
{
/*
* To connect to xmms2d you need to first have a
* connection.
*/
xmmsc_connection_t *connection;

/*
* xmmsc_result_t is the struct returned from all
* commands that are given to the xmms2d server
* we just declare a variable of this type here,
* we'll need it later.
*/
xmmsc_result_t *result;

/*
* xmmsv_t is the wrapper struct used to communicate
* values to/from the server. Typically, when a client
* issues commands, the server answers by sending back
* the return value for the command. Here, we will only
* use it to check if the server returned an error.
*/

xmmsv_t *return_value;

/*
* We need a string pointer to retrieve the error (if any)
* from the xmmsv_t. Note that the string will still be
* owned by the xmmsv_t structure.
*/
const char *err_buf;

/*
* First we need to initialize the connection;
* as argument you need to pass "name" of your
* client. The name has to be in the range [a-zA-Z0-9]
* because xmms is deriving configuration values
* from this name.
*/
connection = xmmsc_init ("tutorial1");

/*
* xmmsc_init will return NULL if memory is
* not available
*/
if (!connection) {
fprintf (stderr, "OOM!\n");
exit (EXIT_FAILURE);
}

/*
* Now we need to connect to xmms2d. We need to
* pass the XMMS ipc-path to the connect call.
* If passed NULL, it will default to
* unix:///tmp/xmms-ipc-<user>, but all xmms2 clients
* should handle the XMMS_PATH enviroment in
* order to configure connection path.
*
* xmmsc_connect will return NULL if an error occured
* and it will set the xmmsc_get_last_error() to a
* string describing the error
*/
if (!xmmsc_connect (connection, getenv ("XMMS_PATH"))) {
fprintf (stderr, "Connection failed: %s\n",
xmmsc_get_last_error (connection));

exit (EXIT_FAILURE);
}

/*
* This is all you have to do to connect to xmms2d.
* Now we can send commands. Let's do something easy
* like getting xmms2d to start playback.
*/
result = xmmsc_playback_start (connection);

/*
* The command will be sent, and since this is a
* synchronous connection we can block for its
* return here. The async / sync issue will be
* commented on later.
*/
xmmsc_result_wait (result);

/*
* When xmmsc_result_wait() returns, we have the
* answer from the server. We now extract that value
* from the result. Note that the value is still owned
* by the result, and will be freed along with it.
*/
return_value = xmmsc_result_get_value (result);

/*
* Let's check if the value returned by the server
* is an error, and print it out if it is.
*/
if (xmmsv_is_error (return_value) &&
xmmsv_get_error (return_value, &err_buf)) {
fprintf (stderr, "playback start returned error, %s",
err_buf);
}

/*
* This is very important - when we are done with the
* result we need to tell that to the clientlib,
* we do that by unrefing it. this will free resources,
* including the return_value, and make sure that we don't
* leak memory. It is not possible to touch the result or
* the return_value after we have done this.
*/
xmmsc_result_unref (result);

/*
* Now we are done, let's disconnect and free up all
* used resources.
*/
xmmsc_unref (connection);

return (EXIT_SUCCESS);
}

---------------------------------------------------

xmms2 Includes:

/usr/include$ ls -liaR xmms2
xmms2:
total 28
2877645 drwxr-xr-x 5 root root 4096 2009-10-06 21:10 .
2613253 drwxr-xr-x 43 root root 12288 2009-10-06 21:10 ..
3031064 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 xmms
3031043 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 xmmsc
3031102 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 xmmsclient

xmms2/xmms:
total 92
3031064 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 .
2877645 drwxr-xr-x 5 root root 4096 2009-10-06 21:10 ..
3031067 -rw-r--r-- 1 root root 944 2008-06-15 18:31 xmms_bindata.h
3031068 -rw-r--r-- 1 root root 1764 2008-06-15 18:31 xmms_config.h
3031069 -rw-r--r-- 1 root root 1598 2008-06-15 18:31 xmms_error.h
3031071 -rw-r--r-- 1 root root 1248 2008-06-15 18:31 xmms_ipc.h
3031072 -rw-r--r-- 1 root root 1425 2008-06-15 18:31 xmms_log.h
3031074 -rw-r--r-- 1 root root 5845 2008-06-15 18:31 xmms_medialib.h
3031076 -rw-r--r-- 1 root root 8060 2008-06-15 18:31 xmms_object.h
3031077 -rw-r--r-- 1 root root 13212 2008-06-15 18:31 xmms_outputplugin.h
3031079 -rw-r--r-- 1 root root 1414 2008-06-15 18:31 xmms_plugin.h
3031081 -rw-r--r-- 1 root root 3529 2008-06-15 18:31 xmms_sample.h
3031083 -rw-r--r-- 1 root root 1410 2008-06-15 18:31 xmms_streamtype.h
3031086 -rw-r--r-- 1 root root 832 2008-06-15 18:31 xmms_strfunc.h
3031088 -rw-r--r-- 1 root root 835 2008-06-15 18:31 xmms_util.h
3031090 -rw-r--r-- 1 root root 11627 2008-06-15 18:31 xmms_xformplugin.h

xmms2/xmmsc:
total 64
3031043 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 .
2877645 drwxr-xr-x 5 root root 4096 2009-10-06 21:10 ..
3031044 -rw-r--r-- 1 root root 3169 2008-06-15 18:31 xmmsc_coll.h
3031045 -rw-r--r-- 1 root root 955 2008-06-15 18:31 xmmsc_errorcodes.h
3031046 -rw-r--r-- 1 root root 5978 2008-06-15 18:31 xmmsc_idnumbers.h
3031047 -rw-r--r-- 1 root root 104 2008-06-15 18:31 xmmsc_inline.h
3031049 -rw-r--r-- 1 root root 3129 2008-06-15 18:31 xmmsc_ipc_msg.h
3031051 -rw-r--r-- 1 root root 1906 2008-06-15 18:31 xmmsc_ipc_transport.h
3031053 -rw-r--r-- 1 root root 1264 2008-06-15 18:31 xmmsc_sockets.h
3031055 -rw-r--r-- 1 root root 198 2008-06-15 18:31 xmmsc_stdbool.h
3031056 -rw-r--r-- 1 root root 346 2008-06-15 18:31 xmmsc_stdint.h
3031057 -rw-r--r-- 1 root root 224 2008-06-15 18:31 xmmsc_stringport.h
3031059 -rw-r--r-- 1 root root 1077 2008-06-15 18:31 xmmsc_strlist.h
3031060 -rw-r--r-- 1 root root 99 2008-06-15 18:31 xmmsc_unistd.h
3031061 -rw-r--r-- 1 root root 1969 2008-06-15 18:31 xmmsc_util.h

xmms2/xmmsclient:
total 28
3031102 drwxr-xr-x 2 root root 4096 2009-10-06 21:10 .
2877645 drwxr-xr-x 5 root root 4096 2009-10-06 21:10 ..
3031105 -rw-r--r-- 1 root root 17309 2008-06-15 18:31 xmmsclient.h


--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms.se
http://lists.xmms.se/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to