I have installed ffmpeg (version 4) with Homebrew and I am trying to use the various ffmpeg libraries in a C++ project, but I am getting multiple errors during linking.
Undefined symbols for architecture x86_64: "_av_free", referenced from: _main in main.cpp.o "_av_packet_alloc", referenced from: _main in main.cpp.o "_av_parser_init", referenced from: And so on ... I have included the libraries as follow
extern "C" { #include <libavutil/frame.h> #include <libavutil/mem.h> #include <libavcodec/avcodec.h> } But still, this doesn't work. I think I might have missed something in my CMakeLists.txt file, which at the moment looks like that :
cmake_minimum_required(VERSION 2.6) project(decode_encode) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "-D__STDC_CONSTANT_MACROS") add_executable(decode_encode main.cpp) I most likely need to specify additional linking flags, but is there is a better way to handle the linking part in a CMakeLists.txt file?
target_link_libraries()call.