Solved

Using Debug/Release libraries in MS VC++.

Posted on 1998-11-25
9
166 Views
Last Modified: 2010-04-01
I have a project in MS VC++ 6.0 that needs to link to .LIB files.  I ussually just do this by including the .LIB file in the project workspace.  The problem is that I need to use a different .LIB file in the debug and release versions.  How do I do that?  (Without changing the workspace each time I change configurations.)  Note the 2 .LIBs have same name, but are in different directories.
0
Comment
Question by:nietod
[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
9 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1178622
What is the problem? You can just add the lib file link setting in the project file
0
 
LVL 22

Author Comment

by:nietod
ID: 1178623
I'm not sure what you mean or where/how to do it.  As I said, the only way I've done this before is to place the file in the project workspace.  That file has to be at a specific path that (as far as I can tell) can't change depending on the current configuration.)
0
 
LVL 86

Expert Comment

by:jkr
ID: 1178624
nietod, you might want to try the following:
#ifdef _DEBUG
#pragma comment( lib, "debug.lib")
#else
#pragma comment( lib, "release.lib")
#endif


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 22

Author Comment

by:nietod
ID: 1178625
That looks promissing.  I'll try that in a few minutes.  (That's programmer minutes.)  I'll let you know.  
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1178626
In developer studio, you do have two build configurations, one debug and one release?

If so, go in the project setting dialog (MENU PROJECT - CHOICE SETTINGS).

In that dialog you will see a combo box where you can select a build configuration, debug or release.
Select debug, go in the LINK property page.
Select the INPUT combo option.
Add your lib file in the appropriate edit box there.

Next select your release project build configuration.
In the same edit box add the other lib file for your release build.
0
 
LVL 2

Expert Comment

by:cyrilbdt
ID: 1178627
Mirkwood is right. Alt+F7|Link - General. type your debug lib, BUT from Settings for choose debug.
0
 
LVL 22

Author Comment

by:nietod
ID: 1178628
plaroche, your solution might have worked but I was trying jkr's at the time you answered.  Jkr's also has the advantage that the "setting" becomes part of the source code and does not need to be manually set each time a project is created or recreated (after the project file becomes corrupt).

jkr, please answer.
0
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 1178629
That's exactly why i prefer such a solution for common libraries that are used in a lot of projects - just add the statement to the header, include the header ... et voila ;-)

0
 
LVL 22

Author Comment

by:nietod
ID: 1178630
That's exactly what I've done (put it in the header).

Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Find Visual Studio Tools 2 136
C++ mouse_event mouse look 7 135
What is sub-make ? 2 107
Need some help with mailto 16 44
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

751 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