Home > Back-end >  LNK2001: cannot resolve the external symbol of "public: virtual struct CRuntimeClass *
LNK2001: cannot resolve the external symbol of "public: virtual struct CRuntimeClass *

Time:09-17

I am a novice, according to the baidu library written tutorial "serial communication" VS2010 MFC written procedures, finally appeared compile error LNK2001: cannot resolve the external symbol of "public: virtual struct CRuntimeClass * __thiscall CMscomm1: : GetRuntimeClass (void) const" (? GetRuntimeClass @ CMscomm1 @ @ UBEPAUCRuntimeClass @ @ XZ); Can one day get the maybe find their own reasons, strives for the great god answers,

CodePudding user response:

Cannot resolve external symbol commonly there are two cases
1. Link library without load
2. The library is wrong, such as library call specification (__thiscall is one of a kind of specification), or configure different (some libraries is win32, some are x64)

CodePudding user response:

May be both
1, in. H file wrote DECLARE_DYNAMIC, not written IMPLEMENT_DYNAMIC in. CPP file
2, in. H file wrote DECLARE_DYNCREATE, but in. Write the IMPLEMENT_DYNCREATE CPP file no

CodePudding user response:

Do you have other projects to add CMScomm controls, if any, you try to manually add "mscomm1. CPP files to your project,

CodePudding user response:


See if the two files with red mark, that is not loaded, select properties l bar there are true choice, loaded with respect to OK

CodePudding user response:

According to https://www.cnblogs.com/xiongjiaji/archive/2010/12/31/2476565.html to provide guidance, as follows:

A check on the Internet and found the following Settings can be:
C/C + + | Language | Treat would be the as built - in type: yes? no?
By default, set to no,
]

Can be solved,

CodePudding user response:

IMPLEMENT_DYNAMIC DECLARE_DYNAMIC () () in respectively. H and. CPP in the statement, if only declaration DECLARE_DYNAMIC () the above mistakes will happen,
  • Related