problem in C++
I tried to include some assembly code into C++ but I didn't worked.
In Windows all is just fine but with this code in test.cpp: #include <iostream> using namespace std; int main() { char *a="this is a message"; int len=strlen(a); _asm{ //some assembly code } return 0; } when "g++ -o test test.cpp" I receive an error telling me he doesn't know what "_asm" is. Could someone tell me how could I correct this? Thanks! |
This link will help you out a lot.
http://cs.wwc.edu/~aabyan/Unix/Assembly.html |
If I'm not mistaken, _asm is a VC++ macro so g++ has no idea what you're talking about. To do this, just put the asm code in a .asm file, use nasm to assemble the code to a .o file and then use g++ -c to compile your c++ code and then use g++ -o outfile obj1.o obj2.o asmbleycode.o cpluspluscode.o main.o (etc...whatever, howevery many files you have) to make the final executable binary
|
All times are GMT -5. The time now is 03:23 PM. |