It is impossible to link ffmpeg libraries to NetBeans. I specified the path for additional libraries, indicated the libraries themselves, and as a result undefined reference:

g++ -m32 -static -mwindows -o dist/Release/MinGW-Windows/test1 build/Release/MinGW-Windows/main.o -L/D/Programms/MinGW/ffmpeg/lib -lavdevice.dll -lavformat.dll build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x3dd): undefined reference to `avdevice_register_all()' build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x3e2): undefined reference to `av_register_all()' build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x484): undefined reference to `avdevice_register_all()' build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x489): undefined reference to `av_register_all()' collect2.exe: error: ld returned 1 exit status 

Linker settings window: Linker settings window I also tried, instead of selecting library files, to specify the -lavdevice -lavformat string in the additional parameters of the compilation — it finds no errors, but still undefined reference. At the same time, in the properties of the compiler, he indicated the paths to include and the editor does not emphasize the ffmpeg functions in red, even offers them via ctrl + space. Includes are:

 #include <libavdevice/avdevice.h> #include <libavformat/avformat.h> 

What could be the problem? Is this a "broken" ffmpeg build or did I miss something?

PS: maybe there is something related to pkg-config?

    1 answer 1

    Damn, I killed 3 hours to find an answer. It turned out that it was necessary to wrap the include:

     extern "C"{ #include <libavdevice/avdevice.h> #include <libavformat/avformat.h> } 

    Maybe someone will come in handy ...