That fixed it! Thank you thank you thank you!
On Mon, Apr 12, 2010 at 2:25 PM, Matt Schuckmannn <[email protected]> wrote: > Did you try wrapping the include of avcodec.h in extern "C" like so: > > extern "C" { > #include <libavcodec/avcodec.h> > } > > > On 4/12/2010 12:08 PM, Robert Conner wrote: >> >> I cannot for the life of me get libavcodec to fully link to a small >> program I'm trying to write. >> >> Here is a super simple hello world type program >> >> """ >> #include<libavcodec/avcodec.h> >> >> int main(int argc, char **argv) { >> >> AVCodec *codec; >> avcodec_init(); >> >> } >> """ >> >> >> And I compile this like this. And no matter what I do I get this >> "undefined reference to `avcodec_init()'" error. I cannot get rid of >> it. I've tried installing libavcodec with apt-get, I've tried >> compiling it and building it myself and linking to it. I've tried >> several versions of libavcodec, I've tried it with libavformat. No >> matter what I do, I always get this same error. What am I doing wrong? >> (I'm on Ubuntu). Thank you so much for any help!! This is driving me >> nuts, I've been on it for days trying everything I could think of or >> find on the internet. >> >> """ >> > g++ -I./ffmpeg -c -o example.o example.cpp >> > g++ -L./ffmpeg/libavcodec -L./ffmpeg/libavutil -Wl,-E -o example >> example.o -lavcodec -lavutil >> example.o: In function `main': >> example.cpp:(.text+0x7): undefined reference to `avcodec_init()' >> collect2: ld returned 1 exit status >> """ >> _______________________________________________ >> libav-user mailing list >> [email protected] >> https://lists.mplayerhq.hu/mailman/listinfo/libav-user >> > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
