Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following approach assumes that every .EXE/app (which uses this library) has its own Visual Studio Solution.</p> <p>You do have control over the library, right? Steps 1-3 will make changes to its project file, and step 4 adds a file to the library source code.</p> <ol> <li><p>Set Project Properties > C/C++ > Advanced > Force Includes to <code>mylibrary_solution_defines.h</code> .</p></li> <li><p>Edit Project Properties > C/C++ > General > Additional Include Directories to put <code>$(SolutionDir);</code> at the beginning of the list of directories.</p></li> <li><p>Set both Project Properties > General > Output Directory and Intermediate Directory to something relative to the solution directory. Perhaps <code>$(SolutionDir)$(ProjectName)\$(Configuration)</code>? You want to make sure the library gets rebuilt for every solution that uses it; there shouldn't be any sharing of .lib or .obj files.</p></li> <li><p>Create an empty, dummy header file called <code>mylibrary_solution_defines.h</code> and put it in your library source code so a <code>#include "mylibrary_solution_defines.h"</code> will never fail.</p></li> <li><p>In every app/EXE solution -- assuming you have different solutions for each app that uses this library, otherwise this whole plan will fail -- create a <code>mylibrary_solution_defines.h</code> file with your #defines in it.</p></li> </ol> <p>Do you see what's happening? Every library source file implicitly <code>#include</code>s <code>"mylibrary_solution_defines.h"</code>, and it preferentially gets that file from the solution directory. So that file can be different for every solution. So if your solution <code>ConsoleModeInterfaceProgram.sln</code> needs the library built with <code>#define TEXTONLY 1</code>, put that line into the <code>mylibrary_solution_defines.h</code> that's in the same directory as <code>ConsoleModeInterfaceProgram.sln</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload