Hinchy
Hinchy

Reputation: 163

project dependencies order - VS2013

should my project dependency order be:

a.lib depends on ab.lib, a.lib depends on ac.lib

or

ab.lib depends on a.lib, ac.lib depends on a.lib

from a.lib contains base classes/functions used by other libs

FILE a.h

class A
{
public:
 virtual void Update();

 // base function declarations here
 // ...
}

from ab.lib overrides, implements and extends class A

FILE b.h

#include "a.h"
class B : public A
{
public:
 // overridden functions here
 // ...
 void Update();
}

from ac.lib overrides, implements and extends class A

FILE c.h

#include "a.h"
class C : public A
{
public:
 // overridden functions here
 // ...
 void Update();
}

Having tested a similar albeit more complex scenario than this simplified version Visual Studio 2013 doesn't seem to care which way round I set my dependencies up. This has me worried.

Thanks for any help you can provide.

Upvotes: 1

Views: 103

Answers (1)

user1
user1

Reputation: 4131

Let's just say class A's declaration is in a.h

How do you compile ab.cpp (contains class B's definition), by #include'ing "a.h"?
How do you compile ac.cpp (contains class C's definition), by #include'ing "a.h"?

Right?

It means Compile time dependencies have already been set, hence VS 2013 doesn't complain.

ab.lib depends on a.lib, ac.lib depends on a.lib

  • This project dependency is order is correct since when you try to build ab.lib, VS 2013 will first check if a.lib is up-to-date, if a.lib is found up-to-date and then VS proceed to build ab.lib. If not a.lib is built first. This is obvious since ab.lib (class B) is dependent on a.lib (class A). Same thing with ac.lib.

Hope this clarifies.

Upvotes: 1

Related Questions