Assembly Macro Files with Visual Studio 2012
-
First off, I'm not sure where the best place to post this was, but from everyone I've talked to so far, this seems to be a problem with VS 2012 and not the assembly language. This is a problem that's been irritating me for a couple of weeks, and doesn't seem to be getting any better. So let me explain my setup. I have a C++ file where my main is located. The C++ file calls functions that I have written in assembly in a separate file. In this assembly file, there are also several assembly macros that the assembly functions use. Let me make sure I make this perfectly clear: When it is set up this way, everything works PERFECTLY. No warnings, no errors. However, when I try to take assembly macros out, and put them in a separate file, and include them in the assembly file, I get an error:
error A2088: END directive required at end of file
It says that I need an end directive at the end of the macro file. For simplicity's sake, here's the smallest macro:
muldiv macro reg1, reg2
mul reg1;
div reg2;
endmI put this macro in a file "testmac.inc", and put:
include testmac.inc
in the assembly file. Again, to be clear, the codeblock contains EVERYTHING that was in testmac.inc Anyways, so I put end at the end of my macro file, and it gives me a linker error, saying that my c++ and assembly functions were undefined. I have no idea what I'm doing wrong, and I've spent days on Google looking for an answer. Sadly however, google anything with "masm assembly macro" brings up useless results as the assembler is called "Microsoft Macro Assembler" I've talked to several assembly guys, and they all say that my code is just fine, and that it's likely something to do with Visual Studio. Any help would be greatly appreciated. Jacob
-
First off, I'm not sure where the best place to post this was, but from everyone I've talked to so far, this seems to be a problem with VS 2012 and not the assembly language. This is a problem that's been irritating me for a couple of weeks, and doesn't seem to be getting any better. So let me explain my setup. I have a C++ file where my main is located. The C++ file calls functions that I have written in assembly in a separate file. In this assembly file, there are also several assembly macros that the assembly functions use. Let me make sure I make this perfectly clear: When it is set up this way, everything works PERFECTLY. No warnings, no errors. However, when I try to take assembly macros out, and put them in a separate file, and include them in the assembly file, I get an error:
error A2088: END directive required at end of file
It says that I need an end directive at the end of the macro file. For simplicity's sake, here's the smallest macro:
muldiv macro reg1, reg2
mul reg1;
div reg2;
endmI put this macro in a file "testmac.inc", and put:
include testmac.inc
in the assembly file. Again, to be clear, the codeblock contains EVERYTHING that was in testmac.inc Anyways, so I put end at the end of my macro file, and it gives me a linker error, saying that my c++ and assembly functions were undefined. I have no idea what I'm doing wrong, and I've spent days on Google looking for an answer. Sadly however, google anything with "masm assembly macro" brings up useless results as the assembler is called "Microsoft Macro Assembler" I've talked to several assembly guys, and they all say that my code is just fine, and that it's likely something to do with Visual Studio. Any help would be greatly appreciated. Jacob
The error message[^] is nothing to do with Visual Studio, it's produced by the Assembler; you can verify that by assembling the files outside of VS. As to why this should cause an error, I'm afraid it's some years since I worked on MASM. You could review exactly where the message occurs, and what output listing the assembler produces.
Veni, vidi, abiit domum