Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSVC++ Project Dependencies 1

Status
Not open for further replies.

Malachi

Programmer
Aug 13, 2001
38
US
I am building an executable, which depends on a library I also compile. I usually build the library using the command line and then copy it to another directory. Then, I build the executable using a make file of my own designe. I include this library's directory in the directives to compile the source code and link the executable. Now, I am using the MSVC++ 6.0 IDE, and am gaining familiarity with the "projects" and "workspaces", so bear with me.

I noticed I can create dependencies between projects, and have created a dependency of the executable for the library. This means that, if necessary, the library is compiled BEFORE the executable is compiled. However, the resultant library file is not automatically copied to the external directory, where the executable is expecting it to be during it's linking process. Therefore, I sometimes create an "outdated" executable, even though I have the library properly compiled and waiting to be used.

Ideally, I would like the executable to look in the library's "release" directory WITHOUT specifically defining the path to the library in the project properties dialog. Will the IDE recognize the relationship between the executable's dependency on the library, and the ultimate location of the library? For example, if I request a build of the release version of the executable, the library is subsequently checked and compiled if necessary. Then, the executable is compiled. If the library is a dependency of the executable, then will the compiler environment recognize the output location of the library for inclusion in the executables build process?

 
>>will the compiler environment recognize the output location of the library for inclusion in the executables build process?

The answer is no. The project dependency is only a build dependency.

There is a solution to your problem in the Visual Studio IDE.

In the MSDN contents under Technical Articles/Visual Tools/Visual C++ 5.0 there is an article named "Controlling the Build Process with Custom Build Rules". This article explains how to build system commands which can be executed from the Project\Settings...\"post-build steps" tab.

So with this information you could setup the project that builds the library, to copy the .lib file to the Exe projects directory after the .Lib is built and before the .exe is built.

I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top