multi-threaded DLL build of opengl32.lib necessary?

Started by
2 comments, last by rileyriley 18 years, 1 month ago
I am trying to use SDL and OpenGL together, using VC++ Express. SDL requires that I build my application with a multi-threaded DLL runtime. I have been able to get multi-threaded DLL versions of all of the other libraries I'm using except OpenGL, and I've got this last error that I can't get rid of: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library I understand that this is probably because of a conflicting version of OpenGL. I had another similar warning that I got rid of by recompiling my other libraries with the appropriate runtime libraries. So: Do I need a different version of OpenGL? And if so, where can I find one? Thanks for any info. Feel free to let me know if I'm on a track completely wrong... I don't have a lot of experience with the details of linking. Obviously I could just use /NODEFAULTLIB:MSVCRT, but I have the impression that that is a suboptimal solution. PS: Sorry if this should be in the OpenGL forum. I thought it might be a problem general enough to warrant... well, general discussion ;)
--Riley
Advertisement
From a site describing an unrelated program but related error:
(http://www.vrco.com/CAVE_USER/cavelib.html)

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

This may be a result of the fact that the CAVELib library itself is compiled to use the Debug C run-time lib, but the CAVELib includes code from FlexLM for licensing that was compiled with the release versions only of the C run-time lib. In this case, the warning should be harmless because FlexLM and CAVELib do not exchange any heap allocated memory, which is typically where errors occur because the Release C libraries allocated memory differently that the Debug C libraries.
"

I take this to suggest that as long as I am not planning on trading any heap allocated memory with OpenGL, the mismatched libraries should be alright and I can simply suppress the warning. Any confirmations or contradictions for this?

Thanks a lot~

Riley
--Riley
You can indeed link the OpenGL library to any of runtime libraries with no problem, this is because as you say, memory allocation doesnt cross between the two, at best you get/give pointers over the dll boundry, however both of you end up with a copy of the data.
Excellent, thanks for the information.

I assume I will need to keep linking to MSVCRT to keep SDL happy (after all, it's SDL with the demands that bring up this problem in the first place). Does this mean I should not actually use the /NODEFAULTLIB switch? If so, is there another way to suppress this particular instance of this warning?

Thanks again,

Riley
--Riley

This topic is closed to new replies.

Advertisement