Reputation: 523
I'm learning Assembly at my university, and we were given a CD with MASM 615 on it, and we're using the Irvine32 include library. Everything works fine with it on the school computer, but when I try to compile and run the same code on my home computer, I get a link error.
INCLUDE Irvine32.inc
.code
main PROC
mov eax,10000h ; EAX = 10000h
add eax,40000h ; EAX = 50000h
sub eax,20000h ; EAX = 30000h
call DumpRegs
exit
main ENDP
END main
This code works fine on the PC at school. At home, I go into DOS, set the path to the MASM folder, and do Make32 file.
This is the error I get:
LINK32 : error LNK2001: unresolved external symbol _mainCRTStartup
test.exe : fatal error LNK1120: 1 unresolved externals
The program compiles (I get the .lst, .obj, and .pdb files), but that's it. I'm thinking it's because I have a 64-bit operating system at home, but I have zero idea how to get this up and running in a 64-bit enviornment - the CD or the book has nothing on 64-bit systems. There's only a make16 or make32 .bat file. It's a real bummer because that means I can't do any work at home, unless there's a work around?
Upvotes: 7
Views: 27485
Reputation: 1
If you use MASM32, add /coff
parameter.
Example:
ml.exe /c /coff file.asm
Upvotes: 0
Reputation: 11
try to include this
includelib \Irvine\Irvine32.lib
includelib \Irvine\User32.lib
includelib \Irvine\kernel32.lib
Upvotes: 1
Reputation: 466
The other answers were confusing to me so I'll add my solution. In the properties of the project go to
Configuration Properties >> Linker >> Advanced
In Advanced at the top should be Entry Point. Type in main
.
Upvotes: 19
Reputation: 3197
I think you may need to specify the entry point manualy since the default symbol for entry on windows isnt _main but the _mainCRTStartup one from your error message. You can specify entry point with /ENTRY:entry_point (some procedure in your assembly) in your linker options.
Upvotes: 7
Reputation: 1208
I know its a bit late - maybe it helps someone - but you should expose main as public, like this
INCLUDE Irvine32.inc
.code
main PROC
mov eax,10000h ; EAX = 10000h
add eax,40000h ; EAX = 50000h
sub eax,20000h ; EAX = 30000h
call DumpRegs
exit
main ENDP
PUBLIC main
END
Note the second last line
Upvotes: 3