Gå til innhold

Make problemer med xchat mp3stat/send plugin


Anbefalte innlegg

Jeg har aldri koda noe i Linux før, har akkurat lagt det inn.

Så jeg tenkte jeg skulle bli kjent med litt stæsj

Lagde ett plugin til xchat, eneste problemet er at det ikke vil compilere.

 

får denne feilmeldingen når jeg kjører "make"


haakon@deb2k:~/progging/c/xchat-xmms-plugin-thingy$ make

gcc -03 -Wall -fPIC DVER_MINOR=1 -DVER_MAJOR=0 -DVER_PATCH=0 -DVER_STRING="0.1.0" -I/usr/include/glib-1.2 -I/usr/lib/glib/include -DUSE_XMMS   -c -o satyr.o satyr.c

gcc: cannot specify -o with -c or -S and multiple compilations

make: *** [satyr.o] Error 1

 

make fila ser slik ut


haakon@deb2k:~/progging/c/xchat-xmms-plugin-thingy$ cat Makefile

VER_MAJOR       = 0

VER_MINOR       = 1

VER_PATCH       = 0

CC = gcc

CFLAGS += -03 -Wall -fPIC

CFLAGS += DVER_MINOR=$(VER_MINOR) -DVER_MAJOR=$(VER_MAJOR) -DVER_PATCH=$(VER_PATCH)

                -DVER_STRING="$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)"

LDFLAGS = $(CFLAGS) -shared

LIBRARY = libsatyr-$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH).so

OBJECTS = satyr.o



CFLAGS += $(shell glib-config --cflags glib) -DUSE_XMMS

LDFLAGS += $(shell glib-config --libs glib) -lxmms



ALL : $(LIBRARY)



$(LIBRARY) : $(OBJECTS)

       $(CC) $(LDFLAGS) -o $(LIBRARY) $(OBJECTS)



satyr.o : satyr.c xchat-plugin.h



.PHONY : clean

clean :

       rm -rf *.o



.PHONY : install

install : $(LIBRARY)

       rm -f ~/.xchat2/satyr*.so

       cp ./$(LIBRARY) ~/.xchat2

 

programmet ser sånn ut. Har sett på litt kode, og mekka makefila slik jeg trodde det skulle gjøres. men det funka ikke.. og ja xchat-plugin.h ligger i samma mappa som satyr.c, slik det står på xchat sida ;)


#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "xchat-plugin.h"

#include <xmms/xmmsctrl.h>

xchat_plugin *ph; // Plugin handle

// XMMS callback

static int xmms_cb  (char *word[], char *word_eol[], void *userdata);

int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, 

                     char **plugin_desc, char **plugin_version, char *arg)

{

   ph = plugin_handle;

   *plugin_name    = "SatyrPlugin";

   *plugin_desc    = "Ett XMMS plugin for XChat av og for folket";

   *plugin_version = VER_STRING;

   /* Dette blir /kommando i X-Chat */

   // Vise den mp3'en som spiller akkurat nuh /xmms

   xchat_hook_command(ph, "xmms",  PRI_NORM, xmms_cb,  NULL,NULL);

   // Sende den mp3'en som spiller akkurat nå til en kamerat /mp3send <nick>

   xchat_hook_command(ph, "mp3send", PRI_NORM, xmms_cb NULL, (void *) 1);

   xchat_printf(ph, "Satyr loaded successfull");

   return 1;

}

static int xmms_cb ( char *word[], char *word_eol[], void *userdata)

{

   char *buffer    = NULL; // holds the information we will announce with

   char *file      = NULL; // holds the file information for DCC SEND

   if((int)userdata == 1)

   {   // vi skal sende fil

       file = xmms_remote_get_playlist_file(0, xmms_get_playlist_pos(0));

       if(file)

       {

           // ser ikke ut til å funke spes bra med æøå

           xchat_commandf(ph, "dcc send %s "%s"", word[2], file);

       }

       else

       {

           xchat_print(ph, "klarte ikke sende fila");

       }

       

   }

   else

   {   // vi skal skryte av dritet vi speller

       buffer = xmms_remote_get_playlist_title(0, xmms_remote_get_playlist_pos(0));

       if(buffer)

       {

           xchat_commandf(ph, "say «[%s]»", buffer);

       }

       else

       {

           xchat_print(ph, "Noe skummelt skjedde");

       }

   }

   return EAT_ALL;

}

Lenke til kommentar
  • 3 uker senere...
Videoannonse
Annonse

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...