c++ - Visual Studio "synchronize" multiple projects within one solution -
writing own c++ project library in visual studio (couple of projects consist of *cpp, *.h files, not actual .lib file). each of these projects located in single visual studio "solution".
when needed use code 1 project in another, copied it. short term solution. library has grown both in size , functionality, , because of code duplication ended dozens of different versions of same file.
that single solution serve me playground // test ground new ideas. developing projects not libs. holds 50 projects.
i working on visual studio 2015.
lets have setup this:
- dataio project located in
*/solution/#datainputandoutput/dataio/dataio.h
consist both of dataio.h , dataio.cpp - foo project located in
*/solution/#foo/foo/foo.h
consist both of foo.h , foo.cpp
dataio.h:
#pragma once #ifndef __data_io_h__ #define __data_io_h__ // ... extern file * const logfile; // bunch of function declarations #endif // !__data_io_h__ i know not "minimal, complete, , verifiable example" problem lies in logistic of things, not things themselves. , believe description sufficient.
problem #1: in foo.cpp #include "dataio.h" (with possible because added additional include directories in foo project setup) whenever try compile foo given following error: unresolved external symbol every function declaration inside dataio.h , 1 external variable. how can fix problem? need create dataio.lib keep things straight?
i tried add dataio.h , dataio.cpp foo project directly (not copy it, add project) seems bad idea...
i recommend trying out new "shared items project" in vs2015+. shared items project literally set of files. project doesn't build anything. in fact, there no (or no) compilation or linkage settings in shared items project -- settings come the project references shared items project. when reference shared items project other project foo, build of foo happens if files of shared items project items of referencing project.
short of that, can set shared projects build .libs , use project references within visual studio automatically set linkage. think have manually set include paths when doing this, though.
Comments
Post a Comment