Solved

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

Posted on 2003-11-02
6
410 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

688 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