Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using Debug/Release libraries in MS VC++.

Posted on 1998-11-25
9
Medium Priority
?
174 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
Technology Partners: 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 200 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

715 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