Here is my .cpp file:
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved) {
FILE *stream;
fopen_s(&stream, "F:\tmp\_dll\out.txt", "a+");
switch (Reason) {
case DLL_PROCESS_ATTACH:
fprintf(stream, "DLL attach function called
");
break;
case DLL_PROCESS_DETACH:
fprintf(stream, "DLL detach function called
");
break;
case DLL_THREAD_ATTACH:
fprintf(stream, "DLL thread attach function called
");
break;
case DLL_THREAD_DETACH:
fprintf(stream, "DLL thread detach function called
");
break;
}
fclose(stream);
return TRUE;
}
and here is the error:
1>hook.obj : error LNK2005: _DllMain@12 already defined in dllmain.obj
1> Creating library F:projects\_dll_hookDebughook.lib and object F:projects\_dll_hookDebughook.exp
1>F:projects\_dll_hookDebughook.dll : fatal error LNK1169: one or more multiply defined symbols found
I know this question have been asked before and I understand the reason for this error, I can not fix it.
The project's "Use of MFC" is set to "Use Standard Windows Libraries".
What I tried and didn't work:
- I can't see what library/file produces this error, it doesn't show up in the output.
- Remove preprocessor definition of _USRDLL and/or replace it with _LIB.
- Add mfcs120d.lib to Additional Dependencies - that file is not found.
What else can I try?
Thank you!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…