The MASM Forum

General => The Campus => Topic started by: anta40 on August 21, 2014, 12:43:29 AM

Title: Unresolved external symbol '_wait_key@0'
Post by: anta40 on August 21, 2014, 12:43:29 AM

include \masm32\include\masm32rt.inc
includelib \masm32\lib\masm32.lib

.code
start:
    print "Hello world from MASM32...",13,10,0
    inkey
    exit

end start


both MS link (12.00.21005.1) and polink (8.00.1) give the same error message:
Quote
error LNK2001: unresolved external symbol _wait_key@0

Of course, the culprint is inkey.
in which lib the _wait_key function is defined?
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: qWord on August 21, 2014, 12:56:28 AM
Try to check if masm32.lib does exist in the lib directory.
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: jj2007 on August 21, 2014, 01:25:05 AM
Works fine on a normal Masm32 installation. The includelib line is not needed, though.

As qWord wrote, check if the lib file exists. If not, reinstall everything (no, not Windows, just Masm32), and next time treat the Masm32 folders as read-only 8)
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: qWord on August 21, 2014, 01:35:17 AM
just reconsider it: if the lib does not exist, the linker would complain. Maybe something when wrong when building the lib, e.g. the AV removed the corresponding object file.
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: anta40 on August 21, 2014, 02:48:02 AM
Quote from: qWord on August 21, 2014, 01:35:17 AM
Maybe something when wrong when building the lib, e.g. the AV removed the corresponding object file.

You hit the spot.
I tried to rebuild masm32.lib by running make.bat and some errors occured.
So I tried running the commands manually and masm32.lib successfully built without errors.

Oh well, at least my problem solved. Thank you :biggrin:
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: Vortex on August 21, 2014, 03:30:55 AM
Hi anta40,

What are the error messages you receive after running :\masm32\m32lib\make.bat ?
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: anta40 on August 22, 2014, 12:05:23 AM
Hi vortex,

I tried rebuilding masm32.lib once again and there are the errors:
Quote
***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(75) : error A2023:instruction operand must have size
Assembling: fptoa2.asm
fptoa2.asm(74) : error A2023:instruction operand must have size
Assembling: frame3d.asm
Assembling: framegrp.asm

***********

*************
UNICODE Build
*************

Assembling: ucgetline.asm
Assembling: ucleft.asm
Assembling: uclen.asm
Assembling: uclower.asm
Assembling: ucltrim.asm
Assembling: ucmid.asm
Assembling: ucMonoSpace.asm
Assembling: ucmulcat.asm
Assembling: ucremove.asm
Assembling: ucrep.asm
Assembling: ucrev.asm
Assembling: ucright.asm
ucright.asm(7) : fatal error A1000:cannot open file : masm32.inc

The second error, which is related to masm32.inc, can be solved easily by copying masm32.inc first before running make.bat
Not sure about the first one. FYI, I'm using ml version 12.00.21005.1
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: hutch-- on August 22, 2014, 12:34:41 AM
See if the library builds with the old version. 6.14. If it does then its a difference with the later version of ML. If you get the same errors its a problem with your computer's configuration. UAC or AV scanner being the usual culprit.
Title: Re: Unresolved external symbol '_wait_key@0'
Post by: qWord on August 22, 2014, 01:41:48 AM
Later MASM versions are more strict on size/type constrains for some instructions. In this case it is FBSTP, which requires a TBYTE-sized operand: fbstp TBYTE ptr [esp].