Solved

Using Debug/Release libraries in MS VC++.

Posted on 1998-11-25
9
156 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
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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

708 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

15 Experts available now in Live!

Get 1:1 Help Now