-1

We have a legacy C++/CLI solution that generates primary executable, but is being expanded out to generate libraries as well as including relevant unit testing. Since we have a number of classes in both the library and executable that implement a common interface, what is the correct way to organize the solution for it?

Right now we have things loosely as follows:

\Solution
   \Library
      \Interfaces
         myInterface.h
   \Application
      \Widgets
         myWidget.h
         myWidget.cpp

Where the interface is being pulled in as follows:

#include "..\Library\myInterface.h"
  • The one that makes the most sense for you, your organization and your software project. – Robert Harvey Dec 29 '16 at 16:09
4

You can put the header files of your lib whereever you want, just add the folder to your project's "additional include files" folder list. This avoids the need for including like

  #include "..\Library\myInterface.h"

Instead, you can use

  #include <myInterface.h>

This has the not only the advantage of beeing shorter, but it will allow you an easier change to the folder structure at a later point in time if it becomes necessary. This way, there will be a single point - the project file "vcxproj" - where the location of the library (relative to the location of the application) is stored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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