Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Currently I have some shared class files(.cpp and .h) which I include them in around 20 Projects. Currently I have to include them in all of the projects. So if I get some business requirments and I change some of the shared(.cpp or .h) files I have to include them in all the 20 Projects which is kind of tedious.

Is there a way where I can create a shared dll or library and include it all of my Projects. So if I have to change it, I just have to change it once and then just Add Reference to include that dll or library which contains all the shared(.cpp, .h) files.

Any help/recommendations regarding the same, will be highly appreciated.

I am using VS2012 for VC++.

share|improve this question
    
Are you having trouble understanding how to create a shared library? Or are you asking if a shared library is an appropriate solution to your problem? –  RaWz Jun 29 '13 at 10:53
    
@RaWz I am asking if shared library is an appreciate solution for the same? Or is there a better way I am unaware of? –  JNL Jun 29 '13 at 13:20

1 Answer 1

up vote 1 down vote accepted

This would be an appropriate use of a shared library. The difference will be that you will need to include a header file and link to the library versus including the headers and cpp files. However, the advantage is that you can build the library once and link to it once rather than having to build the the same code with every project. If you only add classes to the library that don't change much, which are used commonly throughout your code, it will also help to increase the modularity and stability of your programs.

share|improve this answer
    
Can you please elaborate on the steps on how to go for it or from where can I get more details about the same. It will be of great help. Thanks –  JNL Jul 1 '13 at 14:17
    
How you create a shared library will depend on which platform, ide, and compiler you're using. You should be able to Google shared (or dynamic) library. –  RaWz Jul 3 '13 at 1:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.