Solved

Visual C++ 6 : Multiple projects in the same workspace with dependencies (strange behavior...)

Posted on 2003-11-02
6
406 Views
Last Modified: 2008-01-09
Hi all!

I'm using visual c++ 6.0, with SP5.  I've got a workspace with three projects in it (i've created a test project reproducing the strange behavior) :
Core (which is a dll)
Engine (another dll, depends on Core)
Test (an exe, depends on both dlls)
All of these projects configurations are builded in separate directories (ie. the defaults : "Debug" & "Release").

The problem i'm having is that when I try to do a "Batch Build" -> "Rebuild all" (with all projects configurations checked out), visual c++ is building the projects in this order :

Deleting intermediate files and output files for project 'Core - Win32 Release'.
Deleting intermediate files and output files for project 'Engine - Win32 Release'.
Deleting intermediate files and output files for project 'Core - Win32 Debug'.
Deleting intermediate files and output files for project 'Engine - Win32 Debug'.
Deleting intermediate files and output files for project 'Engine - Win32 Release'.
Deleting intermediate files and output files for project 'Test - Win32 Release'.
Deleting intermediate files and output files for project 'Engine - Win32 Debug'.
Deleting intermediate files and output files for project 'Test - Win32 Debug'.
--------------------Configuration: Core - Win32 Release--------------------
Compiling...
StdAfx.cpp
Compiling...
Core.cpp
Linking...
--------------------Configuration: Engine - Win32 Release--------------------
Compiling...
StdAfx.cpp
Compiling...
Engine.cpp
Linking...

Engine.exe - 0 error(s), 0 warning(s)
--------------------Configuration: Core - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
Core.cpp
Linking...
--------------------Configuration: Engine - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
Engine.cpp
Linking...

Engine.exe - 0 error(s), 0 warning(s)
--------------------Configuration: Engine - Win32 Release--------------------
Compiling...
StdAfx.cpp
Compiling...
Engine.cpp
Linking...
--------------------Configuration: Test - Win32 Release--------------------
Compiling...
StdAfx.cpp
Compiling...
Test.cpp
Linking...

Test.exe - 0 error(s), 0 warning(s)
--------------------Configuration: Engine - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
StdAfx.cpp
Compiling...
Skipping... (no relevant changes detected)
Engine.cpp
Linking...
--------------------Configuration: Test - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
Test.cpp
Linking...

Test.exe - 0 error(s), 0 warning(s)


As you can see, the "Configuration: Engine - Win32 Release" & "Configuration: Engine - Win32 Debug" are both being rebuilded twice.  In this case it's not that bad because there's only 3 projects with a few files, but in my real workspace i've got like 12 projects that are much bigger, and 4 configurations are being rebuilded twice.  A working "Batch Build" would be very useful...  I would like to know what I could possibly be doing wrong and how I can fix this.

Thanks for the help!
Sebastien Lussier
0
Comment
Question by:BobJelly
6 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9669339
Core (which is a dll)
Engine (another dll, depends on Core)
Test (an exe, depends on both dlls)

Try to uncheck dependency of Test on Core in the Project Dependencies dialog. Leave onlu dependencies:
Engine on Core
Test on Engine
0
 
LVL 5

Expert Comment

by:rendaduiyan
ID: 9669393
Try to remove such two configuration under menu "Build->Configuration"
At project tree node "Test", remove 'Engine - Win32 Debug', so to the other one.
good luck.
0
 

Author Comment

by:BobJelly
ID: 9671526
Thanks for your help guys.  Unfortunatelly i've already tried that.  I've also inspected the dsw file and everything seems to be ok in there.  Plus, I deleted all temp files for the dsw and the projects.  I keep getting this strange behavior...

What annoys me is that I had done such thing in the past and never ran into this behavior...  Maybe there's a problem with my VC++ installation, I should try to reinstall it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:RJSoft
ID: 9675837
I think you need to have your object output directed to one directory. Since there is a dependancy, re-compilation may be happening from a failure of the next project to locate the object results of the previous build. Also how would they run unless you had a path variable set??

RJ
0
 
LVL 5

Expert Comment

by:rendaduiyan
ID: 9676958
You are welcome. The last way left is to modify your makefiles.
Try to remove some rules(or constraits?) from the file generated by VC.
Here, TestMain depends on Dll2, and the makefile belongs to TestMain.
!IF  "$(CFG)" == "TestMain - Win32 Release"

"Dll2 - Win32 Release" :
   cd ".\Dll2"
   $(MAKE) /$(MAKEFLAGS) /F .\Dll2.mak CFG="Dll2 - Win32 Release"
   cd ".."

"Dll2 - Win32 ReleaseCLEAN" :
   cd ".\Dll2"
   $(MAKE) /$(MAKEFLAGS) /F .\Dll2.mak CFG="Dll2 - Win32 Release" RECURSE=1 CLEAN
   cd ".."
!ENDIF
I have no other ideas.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
ID: 9865063
Don't mess with the MAKE file!

It is building twice becasue you are asking it to do that.
In the Batch Build dialog, just uncheck Core and Engine.  
Set the project dependancies of Test to include both DLLs.  When you build Test, it will build the dependant DLLs first.

Then you are done.

-- Dan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Handling string inputs in C/Linux 23 179
std::atomic with custom class 6 192
Should CArray be used for a list of pointers in C++? 19 97
Exception thrown at 0x00007FFD5BC81F28 7 38
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now