[FFmpeg-devel] PRIx64 and msvc

info at gardinal.net info at gardinal.net
Wed Mar 8 18:33:25 EET 2023


Le 2023-03-08 09:10, Hendrik Leppkes a écrit :
> On Wed, Mar 8, 2023 at 4:02 PM <info at gardinal.net> wrote:
>> 
>> I'm compiling with msvc and get some errors with PRIx64 and similars.
>> For example:
>> snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
>> 
>> won't compile, but this work (with the extra space):
>> snprintf(name, sizeof(name), "0x%" PRIx64, ch_layout);
>> 
>> Can this be included in the sources without introducing problems for
>> other platforms?
> 
> You'll have to provide more information. We have automated builds with
> MSVC which are running just fine right now.
> 
> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

For example, in ffplay.c sample (ffmpeg version 5.0.2):

if (is->audio_filter_src.channel_layout)
         snprintf(asrc_args + ret, sizeof(asrc_args) - ret,
                  ":channel_layout=0x%"PRIx64,  
is->audio_filter_src.channel_layout);

gives the following error:
error C3688: invalid literal suffix 'PRIx64'; literal operator or 
literal operator template 'operator ""PRIx64' not found

The error is gone when adding a space before PRIx64.

Note that I'm mixing C and C++ in my projet. Compiling in plain C seems 
to work.


More information about the ffmpeg-devel mailing list