Solved

How can I share and edit one class over several projects?

Posted on 2004-04-26
11
244 Views
Last Modified: 2013-11-20
Hi experts,
I created some folders:

c:/GPF-Project
c:/GPF-Project/shared
c:/GPF-Project/DNATranslator
c:/GPF-Project/GPF
c:/GPF-Project/...

Now I would like to have some common classes within c:/GPF-Project/shared.
I need to edit the classes from all other sub directories like GPF and DNATranslator ...
At the moment VS.net keeps creating new source files in the subdirectories when I try to add a function or variable to the class. It however brings me to the right point if I select a function in the class view.
How can I tell VS.net to edit the classes in the location they are and obstain from creating new files?
I add the classes by including the source files in the solution explorer ... Add - Add an existing item ...
Any ideas?
Regards,
Jens
0
Comment
Question by:allmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10925912
Remove the files from the projects.
Move the files into your common folder.
Add the files back into your project.


Note I say files NOT classes
0
 
LVL 5

Author Comment

by:allmer
ID: 10928307
That is exactly what I did.
I chose the appropriate files (xy.h, xy.cpp), deleted them in the solution view, moved them physically to the shared folder and then inserted them back in the solution view (Add existing item).
If I now use the solution view to select the files there is no problem.
If I, however, try to add a function by right-clicking a class in the class view and choose add function it always creates a new file in the current folder and does not add the content to the files in the shared folder.
Best regards,
Jens  
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10928671
Ah.
I use Visual Studio 6.  This procedure works fine there.  Maybe this is one of Microsofts 'improvements'
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:allmer
ID: 10929416
The problem may be my way to include the headers:
if I have 2 files in shared
xy.h and xy.cpp

If xy.h is included like this:
#include "xy.h"  -- didn't let me add a function at all sometimes //not very reproduceable, though.
#include "c:\full-Path\xy.h"  -- leads to a new file to be created.
#include "../shared/xy.h"     -- same problem here.

Is there a trick to that?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10929513
I always use the relative path, again with Visual Studio 6, and that is OK.

is this a typo? - the / instead of \\
#include "../shared/xy.h"

0
 
LVL 5

Author Comment

by:allmer
ID: 10929770
They both usually work fine ;-)
With different platforms you should rather use / than \.

If I right click a class in the class view and choose add variable it works fine.
The only problem is the location of the cpp file when adding functions that way.

Do I have to make any adjustments in VS to tell MS not to create a new file?
Maybe set some include path to be used?

Any suggestions?
Cheers,
Jens
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10930503
Maybe set some include path to be used?

Don't know, but it sounds a real hack if it is required.
0
 
LVL 5

Author Comment

by:allmer
ID: 10950052
What if the folder was read-only?
http://www.experts-exchange.com/Operating_Systems/WinXP/Q_20972289.html
That would probably impose such restrains.
Strange that it works with changing header files that are read-only but not with
cpp files.
There must have been several cooks involved in that ;-}
Anyway, can't find out if this is the solution, yet.
Greets
Jens
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10950131
Why should the folder be read only - but it would be quick for you to test.
0
 
LVL 5

Author Comment

by:allmer
ID: 10950658
You are right and after some ...
It doesn't change a thing if I mess around with the file attributes.
They weren't probably read-only in the first place ... just displayed like that by the explorer.
dir /AR didn't seem to find any read-only files.
0
 
LVL 3

Accepted Solution

by:
akalmani earned 125 total points
ID: 10995217
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mixString challenge 36 137
Replacement selected text 2 69
Trying to run powershell  in a batch file. How do I do this? 8 122
moto 4g phone enable finger print 4 68
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question