Hi All,
I have a visual c++ application I want to run and I have included all the necessary header files and the project compiles with some warnings which can be ignored. But at the linking stage I have the errors listed below. The project tries to display some dialog boxes to prompt the user for inpute data.It uses the MFC classes as base classes. I could not find any fix for the link errors. No similar forums articles seem to help me. Could some one please !!!! tell me what the possible source of the link erros can be.
1>------ Build started: Project: reg, Configuration: Debug Win32 ------
1>Linking...
1>doregDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall Timer::Timer(void)" (??0Timer@@QAE@XZ) referenced in function "public: __thiscall CdoregDlg::CdoregDlg(class CWnd *)" (??0CdoregDlg@@QAE@PAVCWnd@@@Z)
1>doregDlg.obj : error LNK2019: unresolved external symbol "public: unsigned long __thiscall Timer::getTime(void)" (?getTime@Timer@@QAEKXZ) referenced in function "protected: bool __thiscall CdoregDlg::computeAlgo(void)" (?computeAlgo@CdoregDlg@@IAE_NXZ)
1>doregDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall Timer::stop(void)" (?stop@Timer@@QAEXXZ) referenced in function "protected: bool __thiscall CdoregDlg::computeAlgo(void)" (?computeAlgo@CdoregDlg@@IAE_NXZ)
1>doregDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall Timer::start(void)" (?start@Timer@@QAEXXZ) referenced in function "protected: bool __thiscall CdoregDlg::computeAlgo(void)" (?computeAlgo@CdoregDlg@@IAE_NXZ)
1>Debug\reg.exe : fatal error LNK1120: 4 unresolved externals
Which compiler / os are you using? Seems like Visual studio to me.
In any case the headers themselves may not be enough for your project. Make sure you have included all/any additional .lig, .dll flies that may be needed by your project.
Are you including a static library? If so, I had the same problem. It turns out that the library needed to be referenced. Following these steps will show you how to reference a project:
1) In you current solution, right click the solution( "Solution 'SolutionName'" ) and select 'Add -> Existing Project'.
2) Locate the projects' solution you want to reference.
3) Then right-click your your main project and select 'References...'.
4) Then, click on the ''Add New Reference...' button at the bottom of the dialog box.
5) Your referenced project( s ) will appear in a list. Select the project( s ) you want to reference then click 'OK'.
6) Finally, you need to locate the directory of the referenced project( s ) header files. To do this, right-click your main project the click 'Properties'. In the text box( 'Configuration Properties -> C/C++ -> General -> Additional Include Directories' ), set the include directories of the your referenced project( s ).