Solved

Problems building DLLs in VC++ 5.0

Posted on 1997-05-07
2
308 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

729 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