Reputation: 7287
I'm having a small c++ project in Windows with FFmpeg 4.0.2. However, I have weird problem: I'm compiling in x64, having x64 libraries, and having correct link input, but I got the LNK2019 error
AND at the same time "unused libraries" in the linker output /VERBOSE
:
1>Unused libraries:
1> I:\lib\ffmpeg-4.0.2-win64\lib\\avcodec.lib
1> I:\lib\ffmpeg-4.0.2-win64\lib\\avutil.lib
I checked manually that lib files are x64. I:\lib\ffmpeg-4.0.2-win64\lib\
is in the LIBPATH.
Same symptoms with ICC.
How could this happen ?
Upvotes: 0
Views: 304
Reputation: 4411
To include the headers of ffmpeg in a C++ program you have to take in account that ffmpeg uses the C calling conventions. Otherwise your linker will expect C++ name mangling on the function names. However, since ffmpeg is straight C, you'll have to tell you compiler this.
For example if you include avformat.h
in your program do it as follows.
#ifdef __cplusplus
extern "C" {
#endif
#include <avformat.h>
#include <avcodec.h>
#include <avutil.h>
#ifdef __cplusplus
}
#endif
The same goes for the other ffmpeg headers.
Upvotes: 1