Cannot run Assembly code produced by g++ -
Cannot run Assembly code produced by g++ -
i used simple c++ code:
#include <iostream> using namespace std; int main() { int = 9; int b = 4; cout << (a+b) << endl; homecoming 0; } then in terminal, created assembly code using g++ -s flag:
g++ a.cpp -s this produces file named a.s . tried run assembly code using nasm:
nasm -f elf a.s but results in tons of error. (mainly 1 -> error: parser: instruction expected )
i tried with
-masm=intel option.
so, why not piece of assembly code (which produced g++ through running c++ code) work?
actually gnu assembler as works format.
as a.s
the output of as object file. create executable need link ld need link in objects depends on, if source generated gcc, @ to the lowest degree include libc, other object files, but, james's comment contains, might easier
g++ a.s -o prog assembly
Comments
Post a Comment