An Old Guy and His Dog
An Old Guy and His Dog

Reputation: 499

vb6 user-defined type not defined error on full compile

I have some vb6 code I have not compiled in a long time. The last compile is in production. Now I get an error "User-defined type is not defined" when I do a full compile. I'm sure there is a reference missing. But there is no code that is hi-lighted. And I cannot seem to find what reference might be lost.

Any clues as to what I can do to find the missing reference would be very helpful.

Thanks!

Dave

Upvotes: 6

Views: 11636

Answers (4)

t Ledbetter
t Ledbetter

Reputation: 21

Are you still using the same machine in which the original compile was made and / or with the same OS ?

If the answer is no, then there is a chance that VB6 or its like linked to a reference which is no longer available in Win7 or later, this may also include the compiler if you are using a modern version of studio.

Since the code is also in VB6, if you are using any outside commercial controls, and again if not on the same machine, you would loose those links as well if you did not port over the library.

Upvotes: 0

leeand00
leeand00

Reputation: 26402

Make sure all of your object types are spelled right. A simple error like spelling Variant Varient can cause this error as well.

Upvotes: 0

ZnArK
ZnArK

Reputation: 1539

You need to ensure that you have the appropriate items checked in the References dialog. This is outside the code and they are listed in the VBP file (text file).

EDIT Corrected reference storage. Thanks MarkJ

Upvotes: 3

DJ.
DJ.

Reputation: 16257

I've had that happen before it drove me crazy!! But then I found this:

  http://support.microsoft.com/kb/190197  

Occurs when compiling with binary compatibility on. The above solution suggests turning off binary compatibility and re-compiling - then missing reference will then be highlighted.

Other steps you can try:

  • Rather than turning off BC for everything look for ones that have been recently changed
  • search C: drive and dev folder and delete any *.oca files
  • also look in the vbp file for any oca references

Upvotes: 4

Related Questions