Jump to content
  • Advertisement
Sign in to follow this  
GroZZleR

Weird linker warning -- never seen it.

This topic is 5095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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;
}

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I just built a Win32 Static Library, and I'm importing it into a Win32 Console App, could that be the problem?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!