Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems building DLLs in VC++ 5.0

Posted on 1997-05-07
2
Medium Priority
?
310 Views
Last Modified: 2010-04-10

In Visual C++ I use the App Wizard to generate a DLL shell (with the MFC stuff not statically linked),
and add in some objects that I've pre-written, and wish to add to the library. I run Dllxprt32.exe to generate a DEF file from the compiled objects and build the DLL.

So far, so good...

I then build a test app to call into the DLL, and this works fine.

However, when I go back and try to rebuild the DLL at this point I get the following linker error...

mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in
MSVCRTD.lib(dllmain.obj)
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in
MSVCRTD.lib(dllmain.obj); second definition ignored
   Creating library Debug/MfcDLL.lib and object Debug/MfcDLL.exp
Debug/MfcDLL.dll : fatal error LNK1169: one or more multiply defined
symbols found

Now I'm prepared to accept that the two libraries both have a definition of DllMain(),
but how come it built the first time OK?
I need both mfcs42d.lib and msvcrtd.lib to build the DLL...

I'm using Visual C++ 5.0, with Win95
Can anyone tell me what I'm doing wrong?


Thanks,
Steve Hobley.
0
Comment
Question by:sjhobley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:sjhobley
ID: 1163340
Edited text of question
0
 
LVL 1

Accepted Solution

by:
jungel earned 200 total points
ID: 1163341
This is an odd bug that can be take care of by reversing the defualt include/link order.  In project settings,linker tab, input category, place both msvcrtd.lib and mfcs42d.lib in the "Ignore Libraries" text box, separated by commas.

Then, put both of them into the object/library modules text box.  Do a full re-build .  If that doesn't work, reverse the order of the libraries in the object/library modules text box.

What you're doing here is forcing the linker to link in a certain order.  This should solve your problem  (and don't forget to change the settings for the release version as well).

Good luck!!
-Alex
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

610 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