Using VLC from C code

This is a discussion on Using VLC from C code within the Windows Programming forums, part of the Platform Specific Boards category; Hi all... First, excuse me for bad english... I'm new in C programming language, and I'm trying to run VLC ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    1

    Using VLC from C code

    Hi all...
    First, excuse me for bad english...
    I'm new in C programming language, and I'm trying to run VLC from C code, using the libvlc.dll library. I found a tutorial at
    http://wiki.videolan.org/LibVLC_Tutorial_086c

    and I followed all the steps, using Dev-cpp as editor, but I couldn't compile the project.
    These are the steps I followed:
    1) Create a new project of type win32 Console
    2) Create a new file: main.c, with the following content:
    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <vlc/libvlc.h>
    
    static void quit_on_exception (libvlc_exception_t *excp) {
       if (libvlc_exception_raised (excp)) {
          fprintf(stderr, "error: &#37;s\n", libvlc_exception_get_message(excp));
          exit(-1);
       }
    }
    
    int main(int argc, char **argv) {
       libvlc_exception_t excp;
       libvlc_instance_t *inst;
       int item;
       char *myarg0 = "-I";  char *myarg1 = "dummy";
       char *myarg2 = "--plugin-path=c:\\Programmi\\VideoLAN\\VLC\\plugins";
       char *myargs[4] = {myarg0, myarg1, myarg2, NULL};
       char *filename = "c:\\Pippo.flv";
    
       libvlc_exception_init (&excp);
       inst = libvlc_new (3, myargs, &excp);
       quit_on_exception (&excp);
       item = libvlc_playlist_add (inst, filename, NULL, &excp); 
       quit_on_exception (&excp);
       libvlc_playlist_play (inst, item, 0, NULL, &excp); 
       quit_on_exception (&excp);
       Sleep (10000);
       libvlc_destroy (inst);
       return 0;
    }
    3) I installed the VLC software, version 0.8.6c

    http://download.videolan.org/pub/vid...8.6c-win32.exe

    4) Copy the file libvlc.dll into the System32 directory, so it will be included in my system path

    5) I downloaded the vlc software, (to compile)-version,
    link:
    http://download.videolan.org/pub/vid...8.6c-win32.zip

    and copied the include/vlc folder in the Dev-cpp include folder, so the line #include <vlc/libvlc.h> now is correct.

    6) I've created a makefile addons, where i put the following lines:
    Code:
    VLC_INST = "C:\Programmi\VideoLAN\VLC\"
    VLC_SRC = "C:\Programmi\VideoLAN\vlc-0.8.6c\"
    main: main.c
       VLC_INST = "C:\Programmi\VideoLAN\VLC\"
    VLC_SRC = "C:\Programmi\VideoLAN\vlc-0.8.6c\"
    main: main.c
       $(CC) -o main main.c -I$(VLC_SRC)/include -L$(VLC_INST) -llibvlc
    Finish...but when I try to compile I get error on the last line of the make file addon:
    Code:
    $(CC) -o main main.c -I$(VLC_SRC)/include -L$(VLC_INST) -llibvlc
    with the following error:
    Code:
    *** multiple target patterns. Stop
    Where I'm wrong??
    Anyone can help me??
    Last edited by Morris83; 09-14-2008 at 07:53 AM.

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,639
    You have two targets for main in the Makefile. Get rid of this:
    Code:
    main: main.c
       VLC_INST = "C:\Programmi\VideoLAN\VLC\"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 04:39 PM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

Tags for this Thread


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