Qt Creator with FFmpeg 未解析的外部

Qt Creator with FFmpeg unresolved external

本文关键字:外部 Creator with FFmpeg Qt      更新时间:2023-10-16

我在Windows中使用带有FFmpeg的Qt Creator。我使用 vs2012 构建了 FFmpeg,并在项目构建环境的 INCLUDE 和 LIB 中指定了路径。然而,当我尝试执行此代码时,我遇到了一个错误:

#include "mainwindow.h"
#include <QApplication>
#include "libavcodecavcodec.h"
#include "libavformatavformat.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    av_register_all();
    return a.exec();
}

这是错误:LNK2019:函数_main中引用的未解析外部符号"void __cdecl av_register_all(void)"(?av_register_all@@YAXXZ

有人可以帮忙吗?

你正在将cpp lib链接到C库。

extern "C" {
#include "libavcodecavcodec.h"
#include "libavformatavformat.h"
}