This is about work-flow / ease of managing Visual Studio project.
Project Structure
I have a solution that contains 2 projects.
Structure 1
project
B
(static-library) : Use function from an external library (e.g.Bullet3d
)- include
Bullet
's header - link to
Bullet
's.lib
(roughly speaking)*
- include
- project
C
(application) : Use function/class fromB
, never touchBullet
directly- include
B
's header - link to
B
's.obj
- include
[*] As far as I know, a static library doesn't concern about what it links (+another similar link).
The above tree just describes what I want.
As I tested, the above structure causes unresolved external symbol error
.
Structure 2
It works OK. Here is the structure :-
project
B
:- include
Bullet
's header
- include
project
C
:- include
B
's header - link to
B
's.obj
<------ X - link to
Bullet
's.lib
<------ Y
- include
The X can be done easily in VS2015 :-
- Right click the word References of C in Solution explorer".
- Then, add
B
.
The Y can be done by setting C
's project property or (more advance) manipulate property sheet that C
uses.
Question
Although structure 2 works, it is inconvenient and not intuitive for me.
Whenever a project (e.g. C
) want to import B
, I will also have to do Y ,
i.e. manually link C
to "Bullet
's library" (.lib
).
Is there any technical approach/work-around (syntactic sugar of work-flow) that enable structure 1?
More specifically, I want a way to mark B
as "Any one who refer to me will automatically link to Bullet
's .lib
".
Reference
There are many similar questions but these below questions are about X (project inside my solution) but not Y (automatically link to external project that is not a part of my solution).
- Visual Studio 2010 not autolinking static libraries from projects that are dependencies as it should be supposed to
- What does the "Link Library Dependency" linker option actually do in Visual Studio 2010?
Note: ar-command does not help, because ar is Linux-specific.