error LNK2001: unresolved external symbol and error LNK1120: 1 unresolved externals
if you get errors while linking compiled code and making project output file (such as .exe,.dll) in MVC++ with subject of "error LNK2001: unresolved external symbol and error LNK1120: 1 unresolved externals",It seems there is missing library definition in addition if the message is related with "DEFINE_GUID" ,There is unordered including headers.
http://support.microsoft.com/kb/130869/en-us' Is_Summary = True>
Please check belows;
1-Check all headers that may use,are included
2-Check directories of referenced files are set in project (Right Click to Project in Micosoft Visual Studio 2010>Properties>Configuration Properties>VC++Directories and
3- check Libraries dependencies (Right Click to Project in Micosoft Visual Studio 2010>Properties>Configuration Properties>Linker>Input>Additional Dependencies)
4-Please follow the exact code and if it is about "DEFINE_GUID", initialize GUID (#include ) before include any project based headers.
(http://support.microsoft.com/kb/130869/en-us) obtains detail definition.I copy some part below in case of broken url.
In Microsoft Visual C++, if the version of the compiler is older than a specific version, a GUID must be initialized exactly once. For this reason, there are two different versions of the DEFINE_GUID macro. One version just declares an external reference to the symbol name. The other version actually initializes the symbol name to the value of the GUID. If you receive an LNK2001 error for the symbol name of the GUID, the GUID was not initialized.
Note The DEFINE_GUID macro in the guiddef.h header file declares a GUID. To also define the GUID, include the INITGUID.H header file in the source file where the GUID should be defined.
You can make sure your GUID gets initialized in one of two ways:
Note The DEFINE_GUID macro in the guiddef.h header file declares a GUID. To also define the GUID, include the INITGUID.H header file in the source file where the GUID should be defined.
You can make sure your GUID gets initialized in one of two ways:
- If you are using precompiled header files, include the INITGUID.H header file before defining the GUID in the implementation file where it should be initialized. (AppWizard-generated MFC projects use precompiled headers by default.)
- If you are not using precompiled headers, define INITGUID before including OBJBASE.H. (OBJBASE.H is included by OLE2.H.)
regards,
P.S:Please do not hesitate to share your comments.
Comments
Post a Comment