class - Error LNK 2005 & LNK1169 C++ Visual Studio DLL -
i'm trying create dll plugin obs, when try compile simple script gives me following errors -
error 1 error lnk2005: _dllmain@12 defined in dllmain.obj c:\users\user\documents\visual studio 2013\projects\name\nameenhanced\nameenhanced.obj nameenhanced
and
error 2 error lnk1169: 1 or more multiply defined symbols found c:\users\user\documents\visual studio 2013\projects\name\debug\nameenhanced.dll 1 1 nameenhanced
i've created simple script, has 2 files namely -
handle.h nameenhanced.cpp
these files -
handle.h
#include <windows.h> #include <string> using namespace std; namespace msgebox { class mymessage { public: static void createmessage(hwnd windowsowner, lpcwstr themessage, lpcwstr thetitle, uint theicon){ messagebox(windowsowner, themessage, thetitle, theicon); } }; }
and
nameenhanced.cpp
// nameenhanced.cpp : defines exported functions dll application. // #include "stdafx.h" #include <windows.h> #include "handle.h" bool winapi dllmain(hinstance hinstdll, dword fdwreason, lpvoid lpvreserved) { msgebox::mymessage::createmessage(null, (lpcwstr)"hello", (lpcwstr)"i see you.", mb_iconwarning | mb_canceltrycontinue); switch (fdwreason) { case dll_process_attach: // attach process // return false fail dll load break; case dll_process_detach: // detach process break; case dll_thread_attach: // attach thread break; case dll_thread_detach: // detach thread break; } return true; // successful }
i've tried delete dllmain.obj
file didn't work
i've used https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx base code
i believe visual studio provides dllmain.cpp
source file dll project template , say:
i've tried delete dllmain.obj file didn't work
however won't stop being recreated every build. need clean project , delete dllmain.cpp
project.
Comments
Post a Comment