[FFmpeg-devel] [PATCH] avformat/error_resilience: Allow file to be included in c++ programs

Peter Bennett pb.mythtv at gmail.com
Wed May 16 03:25:57 EEST 2018

From: Peter Bennett <pbennett at mythtv.org>

The header stdatomic.h causes compile errors in a c++ compiler, even
when extern "C" is used around it. The appropriate c++ include is <atomic>.
We cannot use #include <atomic> inside error_resilience.h because that causes
compile errors inside extern "C". With this change, using error_resilience.h in a
c++ program works but requires also including <atomic> in the c++ code.
 libavcodec/error_resilience.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 664a765..7d81c4d 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -20,7 +20,9 @@
 #include <stdint.h>
+#ifndef __cplusplus
 #include <stdatomic.h>
 #include "avcodec.h"
 #include "me_cmp.h"

More information about the ffmpeg-devel mailing list