Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Adding Libraries in Visual C++

Posted on 2003-03-17
2
Medium Priority
?
226 Views
Last Modified: 2013-12-14
Hello there!
I'm new to C++ (Mostly C/ASM before), and have joined the wonderful world of classes! :P

Anyway, when I try to implement a Win32 static library to my project, I get the following error:

LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library

I've tried to create both tiny and bigger libraries, but I always get the exact same warning.

What is this, and why does it happen?
0
Comment
Question by:Caminman
2 Comments
 
LVL 3

Expert Comment

by:Kashra
ID: 8154967
Well, I'm no expert on Visual C++, but it seems like this error happens a lot when trying to incorporate static libraries with an MFC application.

You might try the compiler's suggestion and add the /nodefaultlib option to your project. Hopefully that'll solve your problem.

In Visual C++ 6.0, you can do this by going to:
Project -> Settings -> Link (tab)

Then go to the edit box at the bottom of the dialog box called "Project Options" and add "/nodefaultlib:libc.lib" (without quotations of course) to the options.

Good luck!
0
 
LVL 1

Accepted Solution

by:
jadams117 earned 200 total points
ID: 8155644
You need to make sure the library files used by all your projects are the same - otherwise you'll get clashes between them

To do this:

1 - Go to 'Projects | Settings..' from the main menu
2 - Select all your included projects (by holding Ctrl/Shift while selecting them with the mouse) in the left pane
3 - Select the 'C/C++' tab in the right pane
4 - Select 'Code generation' from the 'Category' combo
5 - Where it says 'Use run-time library' select the library you want to use

Usually you'll want to use the DLL libraries as these will create smaller executable files. For your Debug build select the 'Debug Multithreaded DLL' library. For your Release build select the 'Multithreaded DLL'

Note: If you are planning a release on a machine which may not have the MFC DLLs then you should either build using the non-DLL libraries or include the MFC DLL with your installation

Tip: Always use multithreaded libraries!

Hope this helps
Jad
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall‚Ķ
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

579 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