Solved

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

Posted on 2003-11-02
6
404 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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.

771 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

11 Experts available now in Live!

Get 1:1 Help Now