Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. HELP. . DLLs?????

HELP. . DLLs?????

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debuggingquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello, I am trying to make my first dll. But I cant get it to work. The linker keeps saying it cant find what it needs. MyTestApp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CMyTestClass::~CMyTestClass(void)" (__imp_??1CMyTestClass@@UAE@XZ) MyTestAppDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CMyTestClass::~CMyTestClass(void)" (__imp_??1CMyTestClass@@UAE@XZ) MyTestAppDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CMyTestClass::CMyTestClass(void)" (__imp_??0CMyTestClass@@QAE@XZ) Debug/MyTestApp.exe : fatal error LNK1120: 2 unresolved externals The DLL i created with the AppWizard (MFC DLL) as an extension dll. The only change I made to the whole thing was I add a class (using the class wizard) as CMyTestClass. It Has one Memebr variable and the empty constructor and deconstructors the class wizard creates. I create an .h file to include for my app. The app is just a generic Dlg app made with AppWizard. It include the .h file for the lib. The .h file conatins the class declaration as such: class AFX_CLASS_IMPORT CMyTestClass { public: CMyTestClass(); virtual ~CMyTestClass(); int m_Shit; }; I moved the dll and .lib files to the Applications project directory so it could find them. What am I doing wrong?? PLease help.

    M 1 Reply Last reply
    0
    • L Lost User

      Hello, I am trying to make my first dll. But I cant get it to work. The linker keeps saying it cant find what it needs. MyTestApp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CMyTestClass::~CMyTestClass(void)" (__imp_??1CMyTestClass@@UAE@XZ) MyTestAppDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CMyTestClass::~CMyTestClass(void)" (__imp_??1CMyTestClass@@UAE@XZ) MyTestAppDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CMyTestClass::CMyTestClass(void)" (__imp_??0CMyTestClass@@QAE@XZ) Debug/MyTestApp.exe : fatal error LNK1120: 2 unresolved externals The DLL i created with the AppWizard (MFC DLL) as an extension dll. The only change I made to the whole thing was I add a class (using the class wizard) as CMyTestClass. It Has one Memebr variable and the empty constructor and deconstructors the class wizard creates. I create an .h file to include for my app. The app is just a generic Dlg app made with AppWizard. It include the .h file for the lib. The .h file conatins the class declaration as such: class AFX_CLASS_IMPORT CMyTestClass { public: CMyTestClass(); virtual ~CMyTestClass(); int m_Shit; }; I moved the dll and .lib files to the Applications project directory so it could find them. What am I doing wrong?? PLease help.

      M Offline
      M Offline
      Mike Melnikov
      wrote on last edited by
      #2

      Hi Use Win32 Dynamic-Link Library wizard with option "a dll that exports some symbols" it makes some defines for you like these: #ifdef MY_EXPORTS #define MY_API __declspec(dllexport) #else #define MY_API __declspec(dllimport) #endif modify them a little: #ifdef MY_EXPORTS #define MY_API __declspec(dllexport) #elif defined(_STATIC_MY_LIB_) #define MY_API #else #define MY_API __declspec(dllimport) #endif and use MY_API before your classes: class MY_API CMyTestClass {}; now your should define in dll-project (wizard made it for you) MY_EXPORTS don't define any (MY_EXPORTS|_STATIC_MY_LIB_) in projects that use your dll you can make lib-project using same source files just define _STATIC_MY_LIB_ in project settings. ZMike.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups