Jump to content
KPB

Can't resolve unit named WinDos and Undeclared identifier: 'doserror'

Recommended Posts

I am compiling an old program that was written in borland pascal and now using RAD 10.3 (delphi) CE to run it. 

 

I got an error "Can't resolve unit named WinDos" . ........ERROR_1

I tried using 'windows' and commented  WinDos, WinProcs and WinTypes 

uses 
{ WinDos, WinProcs and WinTypes} windows,

to resolve above ERROR_1 BUT

 

I am getting error about 'doserror' for a code as:

..

..

if (length (name) = some_int) and (pos (':\',name) = some_another_int)
and ((doserror = 18) or (doserror = 0))
then......

...

..

as...

[dcc32 Error] unit.PAS: E2003 Undeclared identifier: 'doserror'

 

What to do?

Share this post


Link to post

As it's name implies, DosError is the error code returned by an MS-DOS function. With Delphi, used to build Windows application, you have Windows API function GetLastError which is more or less the same function.

 

BUT Delphi mostly use exception to report errors. There is also a global variable "error".

 

To help you much, you should publish the part of your application which generate an error.

 

 

 

Share this post


Link to post
Guest
2 hours ago, KPB said:

I am compiling an old program that was written in borland pascal and now using RAD 10.3 (delphi) CE to run it. 

...

[dcc32 Error] unit.PAS: E2003 Undeclared identifier: 'doserror'

What to do?

try:

  • first, copy the "WinDOS.pas" for your project folder, that way you dont need put it in your "Library Path" and "Browse Path" in your Delph platform
  • second, this unti is for "16bits" platform, then, in MSWindows 64bits you'll can have many problems because the "types" used! it was done to Windows95 (if Im not wrong)
  • third, now, just use the clause "USES windos;" on "interface or implementation section" or be, where it is necessary access the types declared in "WinDOS" unit

Some like this:

unit Unit2;

interface

implementation

uses
  WinDOS;

procedure prcXXXXX;
var
  lVarXX: xxxTypeNecessary;
begin
  lVarXX := doserror;
end;

end.

 

At that time, "namespace" was not used when naming Delphi units. Example:

  • RAD 10 ---> Vcl.Forms.pas ---- namespace "Vcl" to indicate that this unit should only be used for VCL framework project!
  • Delphi 7 --- Forms.pas ---- without the namespace as there was no need at that time, as the only existing framework (by default) was for VCL projects

 

image.thumb.png.ee1ee6daee0b4fd4f9dc3b5667491ad8.png

 

Note: "WinDows" may have access to other units (open it and verify), so put them all in your project folder, or list them in Delphi CE's "Library Path" and "Library Browse"

 

hug

Edited by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×