Thread: vlc code example for linux do not compile

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    2

    vlc code example for linux do not compile

    LibVLC Tutorial 086c - VideoLAN Wiki

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <vlc/libvlc.h>
    
    static void quit_on_exception (libvlc_exception_t *excp) {
       if (libvlc_exception_raised (excp)) {
          fprintf(stderr, "error: %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 *filename = "/tmp/WorldOfPadman_Intro.avi";
    
       libvlc_exception_init (&excp);
       inst = libvlc_new (argc, argv, &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);
       usleep (10000000);
       libvlc_destroy (inst);
       return 0;
    }
    return: teste1.c:3:24: fatal error: vlc/libvlc.h: Directory or file not found.
    help me please

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    35,296
    So did you type all this on the command line?
    Code:
    Compile/Link/Run for Linux
    $ export VLC_SRC=/tmp/vlc-0.8.6c
    $ gcc -I ${VLC_SRC}/include/ -lvlc -L ${VLC_SRC}/src/.libs/ demo.c -o demo
    $ export LD_LIBRARY_PATH=${VLC_SRC}/src/.libs/ 
    $ ./demo --plugin-path ${VLC_SRC}
    Have you actually downloaded and installed all the development files?

    You can't just grab random bits of code and expect them to compile without working through the pre-requisites.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    2
    Quote Originally Posted by Salem View Post
    So did you type all this on the command line?
    Code:
    Compile/Link/Run for Linux
    $ export VLC_SRC=/tmp/vlc-0.8.6c
    $ gcc -I ${VLC_SRC}/include/ -lvlc -L ${VLC_SRC}/src/.libs/ demo.c -o demo
    $ export LD_LIBRARY_PATH=${VLC_SRC}/src/.libs/ 
    $ ./demo --plugin-path ${VLC_SRC}
    Have you actually downloaded and installed all the development files?

    You can't just grab random bits of code and expect them to compile without working through the pre-requisites.
    I'm using Geany 1.22 to compile the script in Ubuntu.
    I have VLC installed, but are not sure if the development files. Can you help me with that?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    35,296
    I guess you run package manager, and search for "vlc-dev" to begin with.

    Or you read some more of the tutorial you posted in your first message.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code written in Dev-C++ won't compile on linux
    By FernandoBasso in forum C++ Programming
    Replies: 14
    Last Post: 11-25-2011, 12:56 PM
  2. How to compile Pro*C code on Linux..
    By anwar_pat in forum Linux Programming
    Replies: 2
    Last Post: 10-18-2006, 11:49 PM
  3. This code won't compile in Red Hat Linux 9
    By array in forum Linux Programming
    Replies: 7
    Last Post: 04-27-2004, 06:30 AM
  4. how to compile a c program in Linux
    By xman in forum Linux Programming
    Replies: 4
    Last Post: 03-18-2003, 09:41 AM
  5. Compile my code for Linux?
    By CompiledMonkey in forum Linux Programming
    Replies: 5
    Last Post: 11-17-2002, 01:02 AM
Website Security Test