Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub classing a prg based class gives project error
Message
From
21/06/2002 16:03:16
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00670728
Message ID:
00671228
Views:
21
You misunderstand me I think. I never had TestParent.prg in the same folder as TestChild.prg, there is and only ever was one copy of each and they are in different folders to each other.

The issue I am trying to explain is simply that if two prg's that hold a class definition and a sub-class definition are in different folders to each other (it really doesn't matter exactly where) then it does not seem to be possible to use a relative path in the OF clause of DEFINE CLASS of the sub-class and get a project containing them to build successfully.

Have you tried this yourself ? I really hope you can get it to work because that would prove it was me at fault and not a bug in FoxPro as I am currently suspecting.

David


>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform