VC language

  • Thread starter Thread starter manishpoplii
  • Start date Start date
M

manishpoplii

Hi ,

I have a solution with many projects. I have a class which will be used
by various projects. I have done the implementatio of that class in
common.h file. Now each project is creating the dll using the common.h
file. What is the right way to share a class among multiple projects?

Regards,
Manish Poplii
 
I have a solution with many projects. I have a class which will be used
by various projects. I have done the implementatio of that class in
common.h file. Now each project is creating the dll using the common.h
file. What is the right way to share a class among multiple projects?

First of all, unless your class is a template class, you should split
declaration
and implementation into a hfile and .cpp file.

As to sharing a class, my preferred way is to create a dll with shared
functions / classes and then
link against that dll in other projects that depend upon it.

You can also use a static library, but that means the implementation get
inserted into each project that uses it.
In C++ you can also share files between projects, but I don't do that
because it can get confusing to determine
which file is where.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Back
Top