error: ‘asm’ undeclared (first use in this function)

后端 未结 3 936
醉梦人生
醉梦人生 2021-02-20 06:27

I am getting the following error during compilation:

error: ‘asm’ undeclared (first use in this function)
 EXCHANGE( s, *(a) );
 ^

in a header

3条回答
  •  一个人的身影
    2021-02-20 06:53

    You are compiling with option -std=c99.

    This disables some non-standard GCC extensions like the asm feature.

    See https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-std-112 for some (not very precise) documentation.

    Remove or change the line set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") from your cmakefile if you need inline assembly.

提交回复
热议问题