nasm gcc command error with subprogram as seperate file

前端 未结 1 646
南旧
南旧 2021-01-26 11:11

testing subprograms as external files in nasm. After running :

nasm -f elf subprogram2.asm
nasm -f elf get_int.asm

I then run the gcc:

相关标签:
1条回答
  • 2021-01-26 11:41

    Quoting from the NASM manual:

    GLOBAL is the other end of EXTERN: if one module declares a symbol as EXTERN and refers to it, then in order to prevent linker errors, some other module must actually define the symbol and declare it as GLOBAL.

    So if get_int is defined in get_int.asm you should put the global get_int in get_int.asm, and declare it as extern in any other files that want to use get_int.

    0 讨论(0)
提交回复
热议问题