不高兴你咬我 2016-09-03 05:25 采纳率: 100%
浏览 1492
已采纳

求解,gcc内联汇编标号编译报错

 unsigned long strcpy0(char* dst,const char* src)
{
    __asm__ __volatile__
        (
         ".intel_syntax noprefix\n"
         "POS2:\n"
         "lodsb\n"
         "stosb\n"
         "test al,al\n"
         "jnz POS2\n"
         :
         :
         :"rax","bl"
         );
}

上面代码使用gcc编译的时候报错,请问该怎么解决:
gcc -masm=intel -O3 -c -o test.o test.c
test.c: Assembler messages:
test.c:7: Error: symbol POS2' is already defined
test.c:7: Error: symbol
POS2' is already defined
test.c:7: Error: symbol `POS2' is already defined

  • 写回答

2条回答 默认 最新

  • hijack00 2016-09-03 13:19
    关注

    错误信息说标号POS2重复定义了,可能你在源码其他位置也定义了这个符号。我把你这段代码复制下来进行编译时是正常的,并没有报错。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?