user88595
user88595

Reputation: 99

Unable to run DLL linked C++ exe. "This program cannot be run in DOS mode." error

I am trying to run a console C++ application linking with my DLL files from the command prompt in a XP windows machine. Recently I have started getting "This program cannot be run in DOS mode." as an error message. As I understand this is a filler message in all DLL's to print if this exe was invoked in a pure MS-DOS environment. So Why am I getting this in a Windows CMD window? Is it telling me that one of my DLLs has a problem?

Also I observed immeditaly after the error message the Windows path depiction changes as follows

<--------------Screen Dump------------------------------>

C:\Program Files\MYPROGRAMS\APPLICATIONS>foo.exe This program cannot be run in DOS mode.

C:\PROGRA~1\MYPROG~1\APPLICAT~1>
<--------------Screen Dump------------------------------>

Why does the path text change to Win95 style(for want of better phrase)? Is it somehow setting the system into some compatibility mode?

Most of the googling indicates this error occuring only during installation(unlike my scenario). THis link http://www.personalcopy.com/doserror.htm talks about a variant but the checkboxes are no longer present in the DOS window properties.

Any help and pointers appreciated.

Upvotes: 0

Views: 3204

Answers (2)

Rajakumar
Rajakumar

Reputation: 442

First open the EXE with hex editor ,what u want to run .After open ,can u see the MZ signature at starting...if there is other than MZ ,there may be ,Exe is not a correct form....after this ,u can move next..

Upvotes: 1

user88595
user88595

Reputation: 99

@Hans THis is the linker command (Answering because the text is too big for comments)

/OUT:"......\nt\win32\Release\foo.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:".\foo_cli\Release\foo.exe.intermediate.manifest" /DEBUG /PDB:".......\nt\win32\Release/foo.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "......\nt\win32\release\foo_other_tests.lib" "......\nt\win32\release\foo.lib" "......\nt\win32\release\foo_tests.lib" "......\nt\win32\release\foo_logger.lib" "......\nt\win32\release\ext1.lib" "......\nt\win32\release\ext2.lib"

Upvotes: 0

Related Questions