I use Code :: Blocks (01/16) to transfer the project from Win7 (VS2013) to Ubuntu (Code :: Blocks). There were problems with the transfer. I decided to try with Code :: Blocks on Windows. The following problem occurred: an error occurs during assembly:

error: expected ')' before 'PRId64'

On the line:

snprintf(args, sizeof(args), "sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64, data.iccx[i]->sample_rate, av_get_sample_fmt_name(data.iccx[i]->sample_fmt), data.iccx[i]->channel_layout); 

The space is before the PRIx64 . Included support for 小++11 .

    2 answers 2

    And what is your PRIx64 ? Most likely some kind of macro that was expanded to a string literal of type u or there ul - judging the previous line. Probably, this macro is no longer defined, and your compiler assumes its identifier ...

    PS Well, of course, as I expected - this macro is written in inttypes.h , most likely you do not have a path to Windows Kits or something like that.

    And again - Code :: Blocks is not a compiler , it is a programming environment .

    PPS (adding @Dmitry)

    Since the project is planned to be transferred to Ubuntu, it is undesirable to use header files for Windows. The decision to copy the macro definition:

     #define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" #define __PRI_64_LENGTH_MODIFIER__ "ll" 
    • Added #include "inttypes.h" #include "Windows.h" nothing has changed. Yes, that's why I installed it in ubuntu and in Win7 g ++ 4.9 - Dmitry
    • @Dmitry where did you decide that the PRIx64 macro PRIx64 purely Windows? They also raise questions: the order of defines (in the first, the second is used); possible override of defines (without explicit #undef ); Definition of names beginning with a double underscore (such names are reserved for the compiler). - 伪位蔚蠂慰位蠀蟿

    A possible reason for the lack of a PRId64 macro is that before #include <cinttypes> you need to add #define __STDC_FORMAT_MACROS .