DLL project fails

Hello experts,

Today I have tried to make a dll project. I am sure that before closing up the MFC windows, no linking errors. With nothing changed, I open the workspace again and I have got these linking errors:

Linking...
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/xxx.lib and object Debug/xxx.exp
Debug/xxx.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

I don't know what wrong I did. Have you encountered such questions before? Any suggestion?
pigpigAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vinayak KumbarSr Program ManagerCommented:
Hi,

R the errors coming after rebuild all?
Remove the debug/Release directory and build once again. r the errors coming now also?

VinExpert
0
inprasCommented:
Hi
Restart the system if U canot come over the problems by using methods of VinExpert.
0
pigpigAuthor Commented:
also linking errors...
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

pigpigAuthor Commented:
also linking errors...
0
MichaelSCommented:
If you use MFC you don't have to use DllMain function.
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Try generating same dll in a new workspace. R errors coming?. If not then check project settings.


VinExpert
0
mikeblasCommented:
> If you use MFC you don't have to use DllMain function.


If you carefully examine the errors pigpig posted, you'll see that it's not him who's defining DllMain. It's MFC (for one definition) and the C Runtimes (for the other definition).

..B ekiM
0
chensuCommented:
Coincidentally, I just solved a similar problem yesterday.

PRB: LNK2005 Errors When Link C Run-Time Libs Before MFC Libs
http://support.microsoft.com/support/kb/articles/Q148/6/52.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pigpigAuthor Commented:
Thanks.
Really helpfull answer!
This MFC trick is very tricky.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.