bharath-k

Hi everybody,

I getting two errors in my project.

a) "mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12" already defined in CMyproj.obj

b) fatal error LNK1169: one or more multiply defined symbols found

I am unable to resolve the error. Please help me in resolving this error.

TIA,

Regarads,

K. Bharath.



Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

crescens2k

When creating an MFC dll the DllMain function is already defined in the MFC. This means that you cannot have a DllMain function yourself.

This means, in your source file CMyproj.cpp, get rid of your function DllMain.






Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

bharath-k

Hi crescens,

Thanks for the reply.

I am using VS2005. I had created a win32 project and selected dll option in the wizard. In the project settings I had chosen "Use MFC in a shared dll".

Initially it was working fine. Now also if i create a dummy project like this it works fine. I dont know, from what change it is showing this error. Suggest me what I have to do.

Thanks & Regards,

K. Bharath.





Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

crescens2k

I said what you have to do, get rid of the function DllMain. The MFC uses DllMain to do initialisation of the MFC for you to use so you need to make sure you don't use MFC.

This happens when you create an MFC dll. If that is what you meant to do then you should remember that you can't use the DllMain entry point function since the MFC uses it, but you use other things to do the initialisation.





Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

yan11

Hi,

I have the same problem.

I said what you have to do, get rid of the function DllMain. The MFC uses DllMain to do initialisation of the MFC for you to use so you need to make sure you don't use MFC.

To do what you said,I put the part that concern Dll Main in comment.and i have 0errors and 0 warnings,and thank you for that.I hope that Mandan done like that.Now,the question is:

remember that you can't use the DllMain entry point function since the MFC uses it, but you use other things to do the initialisation.

How is that done

Thanks.






Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

crescens2k

It depends on what you are trying to do, but general initialisation should be under WinApp::InitInstance.

Please look at this technical note for more information.

http://msdn2.microsoft.com/en-gb/library/zfz4xb9a(VS.80).aspx






Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

yan11

Ok,thanks
But I don't know what you mean as WinApp::InitInstance.it's Windows Application maybe so what is the code,o what would I write I 'm doing a dll which exports functions for a service provider.Is there something else that I can say to have a precision in the answer please I see the link that you gave me ,but I did not find exactly what I could add to my code.I don't understand,please help me.
Regards,





Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

crescens2k

OK, in your MFC Dll you have a definition similar to the following.

class MyApp : public WinApp

{

//MyApp definition goes here

};

You will notice that the only method it overrides is InitInstance.

You should add your code to this method.

As to what code you add, I can't tell you since it depends on your application and what you want to do with it.

But if you are confused on class notation and MFC workings then I suggest you read up more on C++ classes and MFC before you even continue.






Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

My Site

Hi

As a support engineer, we have seen this kind of issues.

This might be the issue

===

This might happen becuase of the order of the CRT,MFC lib.

So the conflict is from MSVCRT/D.lib (CRT) linked in before mfcs71/d.lib (MFC).

To resolve it, you could ignore both at Linker--> Input--> Ignore specific Library:
MSVCRT/D.lib;mfcs71/d.lib
Then in the Linker--> Input--> Additional Dependency, add them in correct order
(MFC first) mfcs71/d.lib MSVCRT/D.lib






Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

Christian_UK

Hi Jayaprakash,

I had the same problem and it works.

Thanks





Re: Visual C++ General mfcs80u.lib(dllmodul.obj) : error LNK2005: _DllMain@12

yan11

When creating an MFC dll the DllMain function is already defined in the MFC. This means that you cannot have a DllMain function yourself.

This means, in your source file CMyproj.cpp, get rid of your function DllMain.

Hi!

I did it and it works. You said that I have to add something else.I didn't add anything,I tried to launch my application and I did!!!

Thank you very much. I did'nt add anything and it works what do you think about that can it cause me any problem in the future

But I have another problem.during the debug,I have some variable which,next her value,there is


"impossible to find the specific directory ".but the value is correct.What is the problem please

Regards,