• Advertisement
Sign in to follow this  

Linking Problems

This topic is 3726 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

Hi there I use Visual Studio. All my (50+) libraries are compiled "Multithreaded-Debug", because with "Multithreaded-Debug-DLL" i get linking errors and, even if i get it to work, it won't run on all other peoples computers, because of the mess MS has created. So, i use the old way, which works perfectly fine. Until now. Now i have a 3rd party library, from which i need to use exactly one C-function. However, that library seems to be compiled "Multithreaded-(Debug)-DLL" and now my linker complains with libcmt.lib(calloc.obj) : error LNK2005: _calloc already defined in LIBCMTD.lib(dbgheap.obj). I cannot compile the one way, because i then get this error, i cannot compile the other way, because then i get other errors. I am really frustrated. My question therefore is, whether you know workarounds. Can i somehow encapsulate that function, so that the DLL-linkage is hidden? I was thinking about creating my own DLL, that is compiled using "Multithreaded-Debug-DLL", so that it is able to link, and my non-DLL program can than call through it the function, that i need. However, i don't know, whether THAT will not result in the very same problems. Any other ideas? Thanks, Jan.

Share this post


Link to post
Share on other sites
Advertisement
Hi, I don't really have a solution, but afew things that came into my head..

What kind of linking errors do you get if you compile your libraries as Multithreaded-Debug-DLL? Can you post abit more info about those?

You've already done one work around by compiling them as Multithreaded-Debug to make some errors dissapear, and now your forced to try and do another work around. It seems to me we should try and fix the root of the problem instead.

Also, when you try to run it on other peoples computers, do they have the .net runtimes installed? Any app or lib built in .net requires these on the target machine for it to run, so that may be the cause of the problem..

Share this post


Link to post
Share on other sites
Sorry for the delay.

When i compile with Debug-DLL i essentially get the same errors with the LIBCMT being in conflict with other libraries since now MY libraries are compiled Debug-DLL but a few libraries i use are not. So it's basically the same problem, only that so far i could find all libs compiled without the DLL linkage (or, if they are open-source, i could compile them myself).

I have found a "workaround" that seems to temporarily "fix" the problem. When i tell the compiler to ignore the LIBCMTD.lib, it magically works. I found that trick on some microsoft website. I actually don't understand why it works and i fear it might break when somehow the order of linkage changes or i link to some other new library. So this is only a fix to get it working, but i hope to get to the root of the problem in the near future.

I use C++ (not managed code), not C#, so i don't think other people need the .NET runtime. The computers i tested it on did have .NET installed, however, only that they didn't have Visual Studio installed. AFAIK there is some distributable people need to have installed, but last time i checked (a year ago, or so) MS had not really solved the issue, many people were complaining, that even installing that distributable didn't solve the problem.


I will try again compiling it with DLL-linkage, though that is much work for me (re-configuring 50+ libraries) and since it is late, i won't do it right now. Maybe i simply overlooked something the last time and will be able to get it working this time.

Thanks for the suggestions, though,
Jan.

Share this post


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

  • Advertisement