user7925034
user7925034

Reputation:

error LNK1120: unresolved externals

I am trying to build the following code. But it gives the error as "error LNK1120: 5 unresolved externals". I'm using C++ in Visual Studio 2013. Libraries are included properly. Error comes at avformat_open_input method. I'm using muxing in ffmpeg in my code. Please help.

const char *url = "H:/Sanduni_projects/ad_2.mp4";

AVFormatContext *s = NULL;
int ret = avformat_open_input(&s, url, NULL, NULL);
if (ret < 0)
    abort();

AVDictionary *options = NULL;

av_dict_set(&options, "video_size", "640x480", 0);
av_dict_set(&options, "pixel_format", "rgb24", 0);

if (avformat_open_input(&s, url, NULL, &options) < 0){
    abort();
}

av_dict_free(&options);

AVDictionaryEntry *e;

if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
    fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
    abort();
}

avformat_close_input(&s);

Upvotes: 1

Views: 1069

Answers (2)

user7925034
user7925034

Reputation:

problem fixed. I added this to the code

extern "C" {
    #endif
    #include <libavcodec/avcodec.h>
    #include <libavformat/avformat.h>
    #include <libswscale/swscale.h>
    #ifdef __cplusplus 
}
#endif

Upvotes: 2

Santosh
Santosh

Reputation: 1815

I think you are missing some linking with libraries in your project. Linking libavformat in Visual Studio 2010 will help you more.

Upvotes: 0

Related Questions