visual studio 2010 - LNK 2019 unresolved symbol - FFmpeg -
i'm trying utilize ffmpeg open , read video .avi work on win7 x64 visual studio 2010
for code simple:
#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "sdl.h" #include "sdl_mixer.h" int main (int argc, char *argv[]) { avformatcontext *pfile_video; int s, videostream; avcodeccontext *pcodecctx; avcodec *pcodec; avframe *pframe; avframe *pframergb; avpacket packet; int framefinished; int numbytes; uint8_t *buffer; av_register_all(); if((avformat_open_input(&pfile_video, "ar.avi", null,null)!=0)) cout <<"cannot open video file"<<endl; //if(av_find_stream_info(pfile_video) <0) cout <<"cannot retrive stream information"<<endl; videostream =-1; for(s=0; s<pfile_video->nb_streams;s++){ if((pfile_video->streams[s]->codec->codec_type) == avmedia_type_video) videostream =s; } if(videostream ==-1) cout <<"cannot open video stream"<<endl; f(sdl_init(sdl_init_everything)< 0) cout<< "cannot initialize sdl subsystems"<<endl; if(mix_openaudio(22050,mix_default_format,2, 4096) <0) cout <<"error mixer audio"<<endl; music = mix_loadmus("ar.wav"); if(music == null) {cout <<"error loading music "<<endl; } homecoming 0; }
i linked next .lib files:
avcodec.lib avdevice.lib avfilter.lib avformat.lib avutil.lib postproc.lib swresample.lib swscale.lib
but these errors:
>msvcrtd.lib(cinitexe.obj) : warning lnk4098: la libreria predefinita 'msvcrt.lib' รจ in conflitto con l'utilizzo di altre librerie; utilizzare /nodefaultlib:libreria 1>main_video_ffmpeg.obj : error lnk2019: riferimento al simbolo esterno "int __cdecl avformat_open_input(struct avformatcontext * *,char const *,struct avinputformat *,struct avdictionary * *)" (?avformat_open_input@@yahpapauavformatcontext@@pbdpauavinputformat@@papauavdictionary@@@z) non risolto nella funzione _sdl_main 1>main_video_ffmpeg.obj : error lnk2019: riferimento al simbolo esterno "void __cdecl av_register_all(void)" (?av_register_all@@yaxxz) non risolto nella funzione _sdl_main 1>c:\users\cristina\desktop\opencv\progetti\miei_progetti_vs\video_ffmpeg\debug\video_ffmpeg.exe : fatal error lnk1120: 2 esterni non risolti
i think linker error.. haven't other .lib file ffmpeg library.
you should surround ffmpeg includes extern "c"
extern "c" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "sdl.h" #include "sdl_mixer.h" }
visual-studio-2010 ffmpeg lnk2019
No comments:
Post a Comment