Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

LNK 2001 and LNK 2019 errors

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in C/C++test
link time error at test case compilation
Hi everyone,

I would like to introduce you my brand new link time problem. And here it is. LNK 2001 and LNK 2019 errors.

Here, you can find my ProjectConfigurations/LinkerOptions tab settings;
At User Libraries combobox;
LINKER OPTIONS
/INCREMENTAL /NOLOGO /LIBPATH:"C:\Qt\4.2.1\lib" /LIBPATH:"C:\MAK\makRti3.0\lib" /LIBPATH:"C:\DATAS\work-Akyay\onur.dal.3\ci.AcousticManagement\src\GSL1.8Library\gsl\win32\lib\debug" /LIBPATH:"C:\DATAS\YardimciYazilimlar\boost\lib" /LIBPATH:"C:\DATAS\YardimciYazilimlar\xerces\lib" /LIBPATH:"C:\DATAS\work-Simkon\tags\ci.FederateManagementSystem.00_03\lib\debug" /LIBPATH:"C:\DATAS\work-Simkon\tags\ci.FomLink.00_01\lib\debug" /LIBPATH:"C:\DATAS\work-Simkon\tags\DatasGeo\lib" /DEBUG /PDB:"Debug/AYS.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 librti1516d.lib libFedTime1516d.lib qtmaind.lib QtCored4.lib QtGuid4.lib QtXml4.lib xerces-c_2D.lib FYSd.lib FomLinkLibd.lib DatasGeoD.lib gsl_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib librti1516d.lib libfedtime1516d.lib qtmaind.lib QtCored4.lib QtGuid4.lib QtXml4.lib xerces-c_2D.lib FYSd.lib FomLinkLibd.lib DatasGeoD.lib gsl_d.lib /NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:MSVCP71D

And below, my pretty error lies;

Linking harness for DomainTest

libboost_date_time-vc71-mt-sgd-1_33_1.lib(greg_month.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
libboost_thread-vc71-mt-sgd-1_33_1.lib(tss.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)

...

FomLinkLibd.lib(DTSAKYOwnshipNoiseObj.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(Platform.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(SurfaceVessel.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(SubmersibleVessel.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(BaseEntity.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(PhysicalEntity.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(DTSAKYEntityNoiseObj.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)

FomLinkLibd.lib(DTSAKYTargetEntityNoiseObj.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) referenced in function "public: __thiscall datasfomx::DTSAKYTargetToSelfNoise::DTSAKYTargetToSelfNoise(void)" (??0DTSAKYTargetToSelfNoise@datasfomx@@QAE@XZ)
FomLinkLibd.lib(EmbeddedSystem.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(DTSSensor.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(DTSPassiveSonar.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(DTSTrackingPassiveSonar.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FYSd.lib(simReflectedObjectList.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FYSd.lib(federationConf.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FYSd.lib(FTPListParse.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FomLinkLibd.lib(HLAobjectRoot.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
FYSd.lib(DTSEvents.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)

...

FomLinkLibd.lib(DTSTrackingPassiveSonar.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FomLinkLibd.lib(BaseEntity.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FYSd.lib(federationConf.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FYSd.lib(FTPListParse.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FomLinkLibd.lib(HLAobjectRoot.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FomLinkLibd.lib(EmbeddedSystem.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FYSd.lib(DecoderFactory.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
FYSd.lib(EncoderFactory.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler

...

FYSd.lib(simObjectData.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(simReflectedObjectData.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(IMainComp.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(InteractionEncoderFactory.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(DTSObject.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(DTSBaseEntity.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(EventManager.obj) : error LNK2001: unresolved external symbol _memmove
FYSd.lib(SimManager.obj) : error LNK2001: unresolved external symbol _memmove
SonarImage_7000.obj : error LNK2001: unresolved external symbol _memmove
Target_7000.obj : error LNK2001: unresolved external symbol _memmove

...

FYSd.lib(PlanManager.obj) : error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
FYSd.lib(fedAmb.obj) : error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
TargetImage_7000.obj : error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
TestUnit_31_7000_testdriver.obj : error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
libcpmtd.lib(xlocale.obj) : error LNK2019: unresolved external symbol ___security_cookie referenced in function "protected: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::collate<char>::do_transform(char const *,char const *)const " (?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z)
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcpmtd.lib(cerr.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcpmtd.lib(clog.obj) : error LNK2001: unresolved external symbol ___security_cookie
libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol ___security_cookie

...

FomLinkLibd.lib(EmbeddedSystem.obj) : error LNK2001: unresolved external symbol __assert
FYSd.lib(fedRunner.obj) : error LNK2019: unresolved external symbol __assert referenced in function "public: virtual __thiscall xsd::cxx::tree::_type::~_type(void)" (??1_type@tree@cxx@xsd@@UAE@XZ)
FYSd.lib(simMessage.obj) : error LNK2001: unresolved external symbol __assert
FYSd.lib(FTPClient.obj) : error LNK2001: unresolved external symbol __assert
FYSd.lib(BlockingSocket.obj) : error LNK2001: unresolved external symbol __assert
FYSd.lib(fedRunner.obj) : error LNK2019: unresolved external symbol _strcpy referenced in function "public: bool __thiscall SimFederate::SimFederateRunner::fedSendMessage(class SimMessage *)" (?fedSendMessage@SimFederateRunner@SimFederate@@Z)
DatasGeoD.lib(StrToVal.obj) : error LNK2001: unresolved external symbol _strcpy
libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _strtol
libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _strtol
FYSd.lib(FTPClient.obj) : error LNK2019: unresolved external symbol _strtol referenced in function "public: static long __cdecl nsHelper::CCnv::TStringToLong(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?TStringToLong@CCnv@nsHelper@@SAJABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@Z)
FYSd.lib(federationConf.obj) : error LNK2001: unresolved external symbol _strtol
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _strtol referenced in function "public: void __thiscall StrToVal::projection2Str(enum Coordinate_Types const &,char * const)" (?projection2Str@StrToVal@@QAEXABW4Coordinate_Types@@QAD@Z)
libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _strtol
FYSd.lib(FTPClient.obj) : error LNK2019: unresolved external symbol _fopen referenced in function "public: bool __thiscall nsFTP::CFile::Open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Open@CFile@nsFTP@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
libcpmtd.lib(fiopen.obj) : error LNK2001: unresolved external symbol _fopen
FYSd.lib(FTPClient.obj) : error LNK2019: unresolved external symbol _ftell referenced in function "public: long __thiscall nsFTP::CFile::Tell(void)" (?Tell@CFile@nsFTP@@QAEJXZ)
FYSd.lib(FTPClient.obj) : error LNK2019: unresolved external symbol _isdigit referenced in function "private: bool __thiscall nsFTP::CFTPClient::GetIpAddressFromResponse(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long &,unsigned short &)const " (?GetIpAddressFromResponse@CFTPClient@nsFTP@@ABE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAKAAG@Z)
FYSd.lib(FTPListParse.obj) : error LNK2001: unresolved external symbol _isdigit
DatasGeoD.lib(StrToVal.obj) : error LNK2001: unresolved external symbol _isdigit
@std@@2@V32@0AAVios_base@2@AAHAA_N@Z)

...

DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _fmod referenced in function "public: double __thiscall StrToVal::roundDMS(double const &,long)" (?roundDMS@StrToVal@@QAENABNJ@Z)
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _toupper referenced in function "public: bool __thiscall StrToVal::isValidCoord(char const *,enum Degree_Type)const " (?isValidCoord@StrToVal@@Z)
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _isalpha referenced in function "public: bool __thiscall StrToVal::isValidCoord(char const *,enum Degree_Type)const " (?isValidCoord@StrToVal@@Z)
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _strtod referenced in function "public: void __thiscall StrToVal::str2Double(char const *,double *)" (?str2Double@StrToVal@@QAEXPBDPAN@Z)
libcpmtd.lib(xstod.obj) : error LNK2001: unresolved external symbol _strtod
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _strstr referenced in function "public: void __thiscall StrToVal::str2Projection(char const *,enum Coordinate_Types *)" (?str2Projection@StrToVal@@Z)
DatasGeoD.lib(StrToVal.obj) : error LNK2019: unresolved external symbol _strtok referenced in function "public: void __thiscall StrToVal::str2Longitude(char const *,double *)" (?str2Longitude@StrToVal@@QAEXPBDPAN@Z)
DatasGeoD.lib(GeodeticCoord.obj) : error LNK2019: unresolved external symbol _sqrt referenced in function "public: void __thiscall GeodeticCoord::geocentric(class GeocentricCoord &)const " (?geocentric@GeodeticCoord@@Z)
DatasGeoD.lib(GeocentricCoord.obj) : error LNK2001: unresolved external symbol _sqrt
DatasGeoD.lib(LocalCartesianCoord.obj) : error LNK2001: unresolved external symbol _sqrt
DatasGeoD.lib(TransverseMercator.obj) : error LNK2019: unresolved external symbol _sqrt referenced in function "private: void __thiscall TransverseMercator::initParameters(void)" (?initParameters@TransverseMercator@@AAEXXZ)
DatasGeoD.lib(GeodeticCoord.obj) : error LNK2019: unresolved external symbol _cos referenced in function "public: void __thiscall GeodeticCoord::geocentric(class GeocentricCoord &)const " (?geocentric@GeodeticCoord@@Z)
DatasGeoD.lib(LocalCartesianCoord.obj) : error LNK2001: unresolved external symbol _cos
DatasGeoD.lib(TransverseMercator.obj) : error LNK2001: unresolved external symbol _cos
DatasGeoD.lib(GeodeticCoord.obj) : error LNK2019: unresolved external symbol _sin referenced in function "public: void __thiscall GeodeticCoord::geocentric(class GeocentricCoord &)const " (?geocentric@GeodeticCoord@@Z)
DatasGeoD.lib(LocalCartesianCoord.obj) : error LNK2001: unresolved external symbol _sin
DatasGeoD.lib(TransverseMercator.obj) : error LNK2001: unresolved external symbol _sin

...

libcpmtd.lib(xmbtowc.obj) : error LNK2019: unresolved external symbol __CrtDbgReport referenced in function __Mbrtowc_lk
libcpmtd.lib(locale0.obj) : error LNK2019: unresolved external symbol _setlocale referenced in function "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z)
libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _setlocale
libcpmtd.lib(_toupper.obj) : error LNK2019: unresolved external symbol _islower referenced in function __Toupper_lk
libcpmtd.lib(xgetwctype.obj) : error LNK2019: unresolved external symbol ___crtGetStringTypeW referenced in function __Getwctype
libcpmtd.lib(xtowlower.obj) : error LNK2019: unresolved external symbol ___crtLCMapStringW referenced in function __Towlower
libcpmtd.lib(xtowupper.obj) : error LNK2019: unresolved external symbol ___crtLCMapStringW referenced in function __Towupper
libcpmtd.lib(xwcsxfrm.obj) : error LNK2019: unresolved external symbol ___crtLCMapStringW referenced in function __Wcsxfrm
libcpmtd.lib(uncaught.obj) : error LNK2019: unresolved external symbol "bool __cdecl __uncaught_exception(void)" (?__uncaught_exception@@YA_NXZ) referenced in function "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ)
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xwcsxfrm.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function __Wcsxfrm
libcpmtd.lib(xwcscoll.obj) : error LNK2019: unresolved external symbol ___crtCompareStringW referenced in function __Wcscoll
libcpmtd.lib(xwcscoll.obj) : error LNK2019: unresolved external symbol ____lc_collate_cp_func referenced in function __Wcscoll
libcpmtd.lib(xwcsxfrm.obj) : error LNK2019: unresolved external symbol ____lc_collate_cp_func referenced in function __Wcsxfrm
libcpmtd.lib(xstrcoll.obj) : error LNK2019: unresolved external symbol ____lc_collate_cp_func referenced in function __Strcoll
libcpmtd.lib(xstrxfrm.obj) : error LNK2019: unresolved external symbol ____lc_collate_cp_func referenced in function __Strxfrm
libcpmtd.lib(xstrcoll.obj) : error LNK2019: unresolved external symbol ___crtCompareStringA referenced in function __Strcoll

C:\DATAS\work-Akyay\onur.dal.3\ci.AcousticManagement\test\birim\code\AYF_Birim_Test\Product\TestUnit_31_0\SourceCodeTestCases\TestHarness\Bin\TestUnit_31_7000.exe : fatal error LNK1120: 141 unresolved externals

Error: Linking harness failed for:
DomainTest .

----------------------------

Launching test executable C:\DATAS\work-Akyay\onur.dal.3\ci.AcousticManagement\test\birim\code\AYF_Birim_Test\Product\TestUnit_31_0\SourceCodeTestCases\TestHarness\Bin\TestUnit_31_7000.exe...
Error: Cannot start tests - test executable for DomainTest cannot be found.
Please review the messages in the log above for specific errors that may have caused this problem.

------------------------

Summary of the analysis.
Test configuration: user://CompleteAnalysis
Elapsed time: 00:00:26

------------------------

Unit Testing (Source)
Tested: 1 unit
Skipped: 0 files
Number of generated test cases: 0
ber of executed test cases: 0 (OK=0 FLD=0 ERR=0)
The following problem(s) occurred during testing:

Error: Linking harness failed for:
DomainTest .

Error: Cannot start tests - test executable for DomainTest cannot be found.
Please review the messages in the log above for specific errors that may have caused this problem.

I will be so glad with any little clue that you can give to solve this irritating problem.
Have a nice day

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hello mandal

    In order for C++Test to successfully create the test harness, the definitions for the unresolved external symbols must be available. Therefore if your source code has extern that are not defined during the linking phase, C++Test cannot create the test harness.

    1. Looking at error coming from the attempt to link with the libcpmtd.lib library. C++Test is reporting that it can not find the definition for operator delete.


    libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)

    2. Searching the libcpmtd.lib library for operator delete results in the symbol being referenced in the libcpmtd.lib library, but undefined ( UNDEF) in the library.



    FROM: LIBCPMTD.LIB

    0A2 00000000 UNDEF notype () External | ??3@YAXPAX@Z (void __cdecl operator delete(void *))



    3. The fact C++Test can not find a definition for the operator delete, may be caused by the fact you are telling the linker, not to use the LIBCMTD default library ( /NODEFAULTLIB:LIBCMTD). A search of the LIBCMTD library does indeed reveal a definition for operator delete.


    From: LIBCMTD.LIB

    00E 00000000 SECT4 notype () External | ??3@YAXPAX@Z (void __cdecl operator delete(void *))


    4. If you are overloading operator delete, then you must link with the library with the definition for the overloaded delete operator. This goes for all missing symbols, in order to link you must find where the symbol is defined and link with those libraries.