Weird linker warning -- never seen it.

Started by
10 comments, last by foniks munkee 19 years, 9 months ago
Hey all, I'm getting this bizarre linker error. I'm building a utility library and this started popping up. Linking... LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library Heres the program if it makes a difference:

#pragma comment(lib, "GroZUtilities.lib")

#include <iostream>

#include <CBox2D.h>

int main(void)
{
	CBox2D box;

	std::cout << box.DoSomething() << std::endl;

	return 0;
}
Advertisement
This usually happens when one or more libraries you're linking with uses a different variety of the C runtime library. For example, your main program might be using single-threaded, and one of your libraries is using multithreaded.
I just built a Win32 Static Library, and I'm importing it into a Win32 Console App, could that be the problem?
No, it doesn't depend on the type of application. Check the "Use runtime library" setting for both projects and ensure that they're the same.
Ah, my testing app was set to Debug and my library was set to Release. I guess that caused the conflict?

I can't seem to reproduce the error in Release mode, but if I switch back to Debug it still does it.

Thanks for the help.
Go to the Debug Build Settings and make sure that they are being built in the same thread setting(ie. Single threaded or multi threaded) like merlin9x9 said. It should be a pulldown that you can select it from if you are using MS visual studio.

~Wave
Quote:Original post by IronWolf
Why do you have void in the () by main? I would imagine this would be uneeded.


It's not needed nor harmfull but it's a habit many people with a solid C background uses, since the meaning of
foo() and foo(void) is diffrent in some flavours of C, the first meaning "any number of arguments" or what would today be written with elipsis ... C++ doesn't have this distinction but I still find it nicer to look at :)
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
It's not a serious error, really.

For example, I have my project set up to use the Debug Multithreaded DLL runtime in Debug mode, and the release version, Multithreaded DLL. SDL, however, uses the Multithreaded DLL either way, so I get that warning with debug builds.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by IronWolf
Oh, I see its like how I can use int main or void main. My background is C++ so I have not seen that.


Not quite, because void main is non-standard and won't compile on most compilers [grin]
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
To make it even more fun, the standard says that you don't explicitly have to return anything in int main. If you don't, return 0; is assumed.

This topic is closed to new replies.

Advertisement