d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Compiler Error...
Add Reply New Topic New Poll
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Feb 20 2013 07:18pm

I feel dumb asking for help about a compiler error but I've tried everything that I thought could fix the errors and I also tried known solutions found on google but nothing.

I created a new 64 bit assembly project with the same settings as my others that run fine but when I compiled it I got these errors...

I'm sure that it's something obvious...

Code
Error 1 error LNK2019: unresolved external symbol StackSimulator referenced in function main
Error 2 error LNK1120: 1 unresolved externals


Solutions platform is set to x64
build customization masm files is checked

Here is main.cpp

Code

#include <iostream>

extern "C" void StackSimulator();

int main()
{
StackSimulator();

return 0;
}


and Stack.asm

Code
.data
optionAdd dw "A. Push"
optionRemove dw "B. Pop"
optionView dw "C. View"
optionClear dw "D. Clear"

messageInputChar dw "Enter char: "

.code
StackSimulator proc

ret
StackSimulator endp
end
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Feb 20 2013 09:50pm
i would assume it has to do something it it not being able to find "StackSimulator()" meaning you have not included it in your project some how. as for that idk how to include asm functions into a C project never had to do it, but for any other project you simply include the header file for the function.
Member
Posts: 4,024
Joined: Apr 1 2009
Gold: 64,464.00
Feb 21 2013 01:10am
Try re-creating the project just copy/pasting the code.. might fix it.
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Feb 21 2013 04:20pm
Maybe you're missing a declaration (or two) in your asm file -- see this example here:

http://stackoverflow.com/questions/8054362/mixing-c-and-assembly-files

Another thing is that the command line you're calling to compile the thing isn't complete, so make sure you have that part right too (also in the above link).

edit: just realized that the above link is for x86, so it may not actually be accurate for x64 :(


edit #2: a couple more potentially helpful links:
http://stackoverflow.com/questions/8084835/masm-64-unresolved-external-symbol
http://stackoverflow.com/questions/12379794/lnk-2001-unresolved-external-symbol-maincrtstartup-masm

This post was edited by irimi on Feb 21 2013 04:29pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll