Hi, I want compile with g++ the api-example.c but I can't do this. My command line is :
*g++ api-example.c -o api-example -lavcodec -D__STDC_CONSTANT_MACROS -L/usr/local/lib * The error is: [root@vviwss01 libavcodec]# g++ api-example.c -o api-example -lavcodec -D__STDC_CONSTANT_MACROS -L/usr/local/lib /tmp/ccfU9kml.o: In function `audio_encode_example(char const*)': api-example.c:(.text+0xbf): undefined reference to `avcodec_find_encoder(CodecID)' api-example.c:(.text+0xfe): undefined reference to `avcodec_alloc_context()' api-example.c:(.text+0x131): undefined reference to `avcodec_open(AVCodecContext*, AVCodec*)' api-example.c:(.text+0x2a8): undefined reference to `avcodec_encode_audio(AVCodecContext*, unsigned char*, int, short const*)' api-example.c:(.text+0x309): undefined reference to `avcodec_close(AVCodecContext*)' api-example.c:(.text+0x314): undefined reference to `av_free(void*)' /tmp/ccfU9kml.o: In function `audio_decode_example(char const*, char const*)': api-example.c:(.text+0x341): undefined reference to `av_init_packet(AVPacket*)' api-example.c:(.text+0x359): undefined reference to `avcodec_find_decoder(CodecID)' api-example.c:(.text+0x398): undefined reference to `avcodec_alloc_context()' api-example.c:(.text+0x3ad): undefined reference to `avcodec_open(AVCodecContext*, AVCodec*)' api-example.c:(.text+0x469): undefined reference to `av_free(void*)' api-example.c:(.text+0x4d2): undefined reference to `avcodec_decode_audio3(AVCodecContext*, short*, int*, AVPacket*)' api-example.c:(.text+0x5f2): undefined reference to `avcodec_close(AVCodecContext*)' api-example.c:(.text+0x5fd): undefined reference to `av_free(void*)' /tmp/ccfU9kml.o: In function `video_encode_example(char const*)': api-example.c:(.text+0x629): undefined reference to `avcodec_find_encoder(CodecID)' api-example.c:(.text+0x668): undefined reference to `avcodec_alloc_context()' api-example.c:(.text+0x670): undefined reference to `avcodec_alloc_frame()' api-example.c:(.text+0x6d5): undefined reference to `avcodec_open(AVCodecContext*, AVCodec*)' api-example.c:(.text+0x93a): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)' api-example.c:(.text+0x9b6): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)' api-example.c:(.text+0xa6d): undefined reference to `avcodec_close(AVCodecContext*)' api-example.c:(.text+0xa78): undefined reference to `av_free(void*)' api-example.c:(.text+0xa83): undefined reference to `av_free(void*)' /tmp/ccfU9kml.o: In function `video_decode_example(char const*, char const*)': api-example.c:(.text+0xabf): undefined reference to `av_init_packet(AVPacket*)' api-example.c:(.text+0xaef): undefined reference to `avcodec_find_decoder(CodecID)' api-example.c:(.text+0xb2e): undefined reference to `avcodec_alloc_context()' api-example.c:(.text+0xb36): undefined reference to `avcodec_alloc_frame()' api-example.c:(.text+0xb6c): undefined reference to `avcodec_open(AVCodecContext*, AVCodec*)' api-example.c:(.text+0xc57): undefined reference to `avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket*)' api-example.c:(.text+0xd5b): undefined reference to `avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket*)' api-example.c:(.text+0xdf3): undefined reference to `avcodec_close(AVCodecContext*)' api-example.c:(.text+0xdfe): undefined reference to `av_free(void*)' api-example.c:(.text+0xe09): undefined reference to `av_free(void*)' /tmp/ccfU9kml.o: In function `main': api-example.c:(.text+0xe39): undefined reference to `avcodec_init()' api-example.c:(.text+0xe3e): undefined reference to `avcodec_register_all()' collect2: ld returned 1 exit status What is wrong? Apparently can not link to the libraries
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
