[Libav-user] g++ 4.7.2 fails to compile av_err2str

Wang Bin wbsecg1 at gmail.com
Mon Jan 14 11:01:34 CET 2013


put attach files into ffmpeg source dir or tests dir, run tst_gxx.sh

g++ -I.. -I. -D__STDC_CONSTANT_MACROS   -c -o tst_gxx.o tst_gxx.cpp
tst_gxx.cpp: In function 'int main()':
tst_gxx.cpp:5:5: error: taking address of temporary array
make: *** [tst_gxx.o] Error 1

i think we can use a inline function instead of macro

av_always_inline char* av_err2str(int errnum)

{

	static char str[AV_ERROR_MAX_STRING_SIZE];

	memset(str, 0, sizeof(str));

	return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);

}


2013/1/12 Carl Eugen Hoyos <cehoyos at ag.or.at>

> wb <wbsecg1 at ...> writes:
>
> > g++ 4.7.2 fails to compile av_err2strI use av_err2str
> > in a c++ file, g++ 4.7.2 can not compile it. The error
> > message is "taking address of temporary array".
>
> Please provide a minimal test-case.
>
> Carl Eugen
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130114/93466e91/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_gxx.sh
Type: application/x-sh
Size: 109 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130114/93466e91/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_gxx.cpp
Type: text/x-c++src
Size: 88 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130114/93466e91/attachment.bin>


More information about the Libav-user mailing list