Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sub classing a prg based class gives project error
Message
 
À
21/06/2002 05:20:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00670728
Message ID:
00671150
Vues:
13
It sounds like you still have a reference to the old TestParent.prg somewhere else after you change the child to reference the TestParent that's in the libs subdirectory. That's why it's pulling in both of them. You can figure out where this is happening by removing the TestParent from your project again, but then rename the prg in the local directory. Also comment out the code in TestChild that's calling the TestParent in libs. When you rebuild your code, whatever is trying to pull in the local version of TestParent won't find it and will have an error.

>My apologies - I did mean TestParent gets added twice not TestChild.
>
>However your suggestion about cleaning up the project did not work for me.
>I can reproduce this 100% even with a new clean project.
>I did as you suggested and completely removed TestParent from the project and then packed the project using the Clean Up option. Then when I built the project FoxPro added TWO references to TestParent to the project and then aborted the build process with the error message I previously stated.
>
>Are you not seeing this? The only other factor I can think of is that I do have the project under SourceSafe control but I don't think that is relevant.
>
>Richard
>
>>Are you sure the error isn't regarding Testparent instead? Check your project to make sure you don't have the same PRG name showing up twice. I've only seen this a couple of times. The way to fix it is to delete both programs from the project and pack the project. (You can use the "Clean up project" option on the Project menu.)
>>
>>>I want to sub-class a prg based class but find that I get an error from my project everytime I try to build it.
>>>The error that I'm getting is:
>>>
>>>'The name of the object file for c:\develop\libs\testchild.prg is already used by another program in the project.'
>>>
>>>What it seems to be trying to do is to add the testchild.prg to the project again even though it already is in the project.
>>>
>>>Here's how to trigger this behaviour.
>>>
>>>In testparent.prg put:
>>>DEFINE MyParent AS Session
>>>
>>>ENDEFINE
>>>
>>>In testchild.prg put:
>>>DEFINE MyChild AS MyParent OF testparent.prg
>>>
>>>ENDDEFINE
>>>
>>>You should be able to put these in a project and build it with no errors.
>>>
>>>Now, because I keep my global class definitions in a different place to my application specific ones, I need to change the app-specific testchild.prg in order to allow for a relative path between the two programs:
>>>
>>>DEFINE MyChild AS MyParent OF libs\testparent.prg
>>>
>>>ENDDEFINE
>>>
>>>Build the app again and you will see the error. Can anyone confirm this behaviour ?
>>>
>>>Is this a bug or should I not be using relative pathing ? I know I can workaround provided I use SET PATH and SET PROCEDURE commands but I thought the DEFINE CLASS's OF clause was meant to replace the need for these commands.
>>>
>>>Richard
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform