Despite putting CONSOLE in my comments, I often forget to assemble as a console. :dazzled:
Then I waste time looking for errors caused by assembling a console as a windows based app.
Is there some code I can put in to assemble as a console ?
Thanks.
include \masm32\include\masm32rt.inc
.code
start:
call AllocConsole
inkey "Hello"
exit
end start
Or use RichMasm, it selects automatically the right subsystem ;-)
It assembles O.K.
Wouldn't I need to put that code in my bldall.bat ?
Andy
Andy,
A more elegant solution is to put a little proggie into your buildall.bat that determines what you have. I have hacked together something, see attachment. It uses the autodetect keywords of RichMasm (http://www.masmforum.com/board/index.php?topic=9044.0), and I have very rarely had "false positives" ;-)
What you need to do is insert somewhere after the assembly
CheckSusy %1
if errorlevel==1 (
echo CONSOLE
REM link .. /SUBSYSTEM:CONSOLE ...
) else (
echo Windows
REM link .. /SUBSYSTEM:WINDOWS ...
)