I have a old Visual C++ project that uses a FORTRAN static library for object creation. The current issue I have is that the project was originally made with the Compaq Visual Fortran compiler which uses the DFOR library. However, I get the error:
Error 105 error LNK1104: cannot open file 'dfor.lib'
The issue is that there are remaining references to the lib that are need to be replaced. However, I have rebuilt the project a few times, recreating all the objects that I have source files for, and the error has not resolved. I searched all the files in my project for the string dfor.lib, and these were the only resulting files.
Image of files containing string 'dfor.lib'
In the Project Linker Properties, if I remove the line /defaultlib:"dfor.lib"
in the command line, I get the errors below:
Error 6 error LNK2001: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > __thiscall petMove::toString(void)" (?toString@petMove@@QAE?AV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureView.obj Power Network Capture
Error 23 error LNK2019: unresolved external symbol "protected: __thiscall CZoomView::CZoomView(void)" (??0CZoomView@@IAE@XZ) referenced in function "protected: __thiscall CPowerNetworkCaptureView::CPowerNetworkCaptureView(void)" (??0CPowerNetworkCaptureView@@IAE@XZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureView.obj Power Network Capture
Error 24 error LNK2019: unresolved external symbol "protected: virtual __thiscall CZoomView::~CZoomView(void)" (??1CZoomView@@MAE@XZ) referenced in function "public: virtual __thiscall CPowerNetworkCaptureView::~CPowerNetworkCaptureView(void)" (??1CPowerNetworkCaptureView@@UAE@XZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureView.obj Power Network Capture
Error 7 error LNK2019: unresolved external symbol "public: __thiscall CDialogCurrentPhasor::CDialogCurrentPhasor(class CWnd *)" (??0CDialogCurrentPhasor@@QAE@PAVCWnd@@@Z) referenced in function "public: void __thiscall CCurrentPhasor::SEDialogHandler(void)" (?SEDialogHandler@CCurrentPhasor@@QAEXXZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureDoc.obj Power Network Capture
Error 5 error LNK2019: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > __thiscall petMove::toString(void)" (?toString@petMove@@QAE?AV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ) referenced in function "public: int __thiscall CPowerNetworkCaptureDoc::PushMove(class petMove *)" (?PushMove@CPowerNetworkCaptureDoc@@QAEHPAVpetMove@@@Z) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureDoc.obj Power Network Capture
Error 22 error LNK2019: unresolved external symbol "public: unsigned int __thiscall petMove::getPartType(void)" (?getPartType@petMove@@QAEIXZ) referenced in function "protected: void __thiscall CPowerNetworkCaptureView::OnChar(unsigned int,unsigned int,unsigned int)" (?OnChar@CPowerNetworkCaptureView@@IAEXIII@Z) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureView.obj Power Network Capture
Error 14 error LNK2019: unresolved external symbol "public: virtual __thiscall CDialogRunAnalysisFromFilePF::~CDialogRunAnalysisFromFilePF(void)" (??1CDialogRunAnalysisFromFilePF@@UAE@XZ) referenced in function "protected: void __thiscall CPowerNetworkCaptureDoc::OnAnalysisRunFromFilePF(void)" (?OnAnalysisRunFromFilePF@CPowerNetworkCaptureDoc@@IAEXXZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\Power Network CaptureDoc.obj Power Network Capture
Error 3 error LNK2019: unresolved external symbol _HtmlHelpW@16 referenced in function "protected: void __thiscall CMainFrame::OnHtmlHelp(void)" (?OnHtmlHelp@CMainFrame@@IAEXXZ) C:\Users\Gavin\Desktop\College stuff\1st year (Fresher)\Pet_Gavin\pet_neda\MainFrm.obj Power Network Capture
There are a few more but they are very similar to these ones.
Are these errors ones that would be easier to resolve or do they indicate that the command of /defaultlib:"dfor.lib"
is needed?
The mention of
CMainFrame
in your last error suggests you have an MFC based project here. However theCMainFrame
class is normally part of the MFC project, defined in the filesMainFrm.h
andMainFrm.cpp
. If your project was originally generated by Visual Studio then your project's ReadMe.txt file should confirm that.It seems somewhat suspicious thatCMainFrame::OnHtmlHelp
would have an unresolved reference - but I'm definitely not an MFC expert!It appears support for HTML Help in MFC applications ended with Visual Studio 2010. The Advanced features page of the MFC Application Wizard includes a checkbox for Context-sensitive help (HTML). The documentation for that checkbox points to more information.
In Visual Studio 2010 Documentation the Advanced features page points to this page. However in the Visual Studio 2012 documentation the Advanced features page point to this page which says …
The Visual Studio 2013 documentation points to a similar page
The What's New for Visual C++ in Visual Studio 2012 and Breaking Changes in Visual C++ 2012 pages don't mention HtmlHelp being de-implemented nor do they mention a replacement or workaround.
There's this unanswered SO question: htmlhelp.lib for Visual Studio 2012 MFC app?.
I don't recognise
CZoomView
,CDialogCurrentPhasor
orCDialogRunAnalysisFromFilePF
(which doesn't necessarily mean very much). They don't appear in Visual Studio 2013's MFC documentation which suggests either they are defined in your project or are part of some third-party package.Are you sure your build is compiling all of the .cpp files it should compile? Have you tried rebuilding the entire solution?
If those are classes defined by your project, it is possible they're impacted by the Htmlhelp issue.
You should probably start by trying to resolve the LNK2001
CStringT
error since it is first. The other errors might be downstream effects of that error (if you are lucky).… long misleading (and wrong) section deleted …Taking a second look at that error I realise I was sending you off in completely the wrong direction by focusing on
CStringT
. The pertinent part of the error text is...The unresolved symbol is the function
petMove::toString(void)
theATL::CStringT< … >
part is the return type of the function. The sixth error down is for the related functionpetMove::getPartType(void)
which returns anunsigned int
.Assuming
petMove
is a class (or struct) defined in your project, perhaps examining the implementation of that class will tell you something about the link errors.For example the implementations of
petMove::ToString
andpetMove::getPartType
might be missing; or commented out; or elded by an incorrect#ifdef
.The other four missing symbols are all constructors or destructors
Is it possible your project is missing some implementation files for
CZoomView
,CDialogCurrentPhasor
andCDialogRunAnalysisFromFilePF
? Alternatively you may have a header file that defines constructors and/or destructors that your implementation .cpp file doesn't declare.For example this header defines two constructors ...
… but this implementation file only declares one of them …
That combination will compile successfully but will give a linker error LNK2019