PDA

View Full Version : error LNK2019: unresolved external symbol



Petter Ranefall
September 14, 2005, 12:21:55
This is strange. I recompiled a project that compiled successfully for some months ago, and now I get linker errors (see below). TIS_UDSHL06_vc71.lib is included the in the Additional Dependencies for the Linker input. I am using VC++ 7.1.3088. What could be wrong?


Doc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > __thiscall DShowLib::Grabber::saveDeviceState(void)const " (__imp_?saveDeviceState@Grabber@DShowLib@@QBE?AV?$ basic_string@DV?$char_traits@D@_STL@@V?$allocator@ D@2@@_STL@@XZ) referenced in function "protected: void __thiscall CEasyImage2Doc::On1394Settings(void)" (?On1394Settings@CEasyImage2Doc@@IAEXXZ)
Doc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class smart_ptr<class _STL::vector<class DShowLib::VideoCaptureDeviceItem,class _STL::allocator<class DShowLib::VideoCaptureDeviceItem> >,class refcount_ptr<class _STL::vector<class DShowLib::VideoCaptureDeviceItem,class _STL::allocator<class DShowLib::VideoCaptureDeviceItem> > > > __thiscall DShowLib::Grabber::getAvailableVideoCaptureDevices (void)const " (__imp_?getAvailableVideoCaptureDevices@Grabber@DS howLib@@QBE?AV?$smart_ptr@V?$vector@VVideoCaptureD eviceItem@DShowLib@@V?$allocator@VVideoCaptureDevi ceItem@DShowLib@@@_STL@@@_STL@@V?$refcount_ptr@V?$ vector@VVideoCaptureDeviceItem@DShowLib@@V?$alloca tor@VVideoCaptureDeviceItem@DShowLib@@@_STL@@@_STL @@@@@@XZ) referenced in function "protected: void __thiscall CEasyImage2Doc::On1394Settings(void)" (?On1394Settings@CEasyImage2Doc@@IAEXXZ)

Petter Ranefall
September 14, 2005, 14:34:20
The same thing happens when I am trying to compile the DemoApp.sln from IC Imaging Control 2.1\samples\vc7\DemoApp\ in VC7.1

Petter Ranefall
September 14, 2005, 15:02:28
The problem seems to be mainly in the functions "saveDeviceState" and "loadDeviceState". If I remove them it works, but that is not a good solution since we don't want to edit the device settings each time we start the program.

Stefan Geissler
September 14, 2005, 15:31:25
Hello Petter,

Could you please post the context of the call to saveDeviceState(), so i can see, what parameters you are passing?

Petter Ranefall
September 14, 2005, 15:39:42
std::string cGrabberState = m_pGrabber->saveDeviceState();

Petter Ranefall
September 14, 2005, 16:27:09
Here is the code also for "loadDeviceState"

CWinApp* pApp = AfxGetApp();
CString strSection((LPCSTR)IDS_SECTION_SETTINGS);
CString strEntry((LPCSTR)IDS_ENTRY_REG_DEVICE);
CString text=pApp->GetProfileString( strSection, strEntry, "" );
if( text != "")
{
if( !m_pGrabber->loadDeviceState( (LPCSTR)text ) )
{

Stefan Geissler
September 15, 2005, 09:13:50
Hello,

This error is weird, especially if you did no changes to the project. Other functions like "InitLibrary()" and "startLive()" work? It seems to me that many more unresolved external exist. You may check your project settings and see, whether the TIS_UDSHL06_vc71d.lib is linked to your project (without "d" for release).

Petter Ranefall
September 15, 2005, 09:53:43
I have linked TIS_UDSHL06_vc71d.lib for debug and TIS_UDSHL06_vc71.lib for release. If I remove the calls to "saveDeviceState()" and "loadDeviceState()" I can run the program. Then "InitLibrary()" works and in debug I can run the program using "startLive()" and "stopLive()", but when I quit the program I get the message "Unhandled exception at 0x7c901230 in EasyImage2.exe: User breakpoint." and the debugger breakes at the function "_CrtIsValidHeapPointer()" in dbgheap.c.

If I run the release version the program crashes when I show the live image. The last text in debug_output.txt is:

startLive ended succesfully
DShowLib Function : returns successful Grabber::startLive

Petter Ranefall
September 15, 2005, 09:57:23
Another strange thing.

Today when I tried to Build the vc7\DemoApp the build succeeded and it was possible to run the DemoApp. But when I then tried to Rebuild the DemoApp I got the same linker errors as before.

Stefan Geissler
September 15, 2005, 12:55:03
Hello Petter,

the _CrtIsValidHeapPointer() messages indicates, that debug and release DLLs have been mixed. Is it possible, that you have something mixed up with your IC installation? It sounds for me, that the IC 1.41 (TIS_UDSHL05.lib) libraries are linked to your project.

Petter Ranefall
September 15, 2005, 19:48:27
I have not got any TIS_UDSHL05 files on my disks(I have made a full search). My debug project uses TIS_UDSHL06_vc71d.lib and my release project uses TIS_UDSHL06_vc71.lib.

Stefan Geissler
September 16, 2005, 08:26:06
Hello Petter,

i am a little bit puzzled. I suggest to deinstall and install IC Imaging Control and check what happens. I use the same version of VS .NET as you.

Petter Ranefall
September 16, 2005, 09:14:02
I uninstalled the IC Imaging Control and installed it again. When I compiled the DemoApp I got the following linker errors:

AVIDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall DShowLib::AviSink::AviSink(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> >,class DShowLib::FilterInfoObject const &,enum DShowLib::GrabberSinkType::tSinkModes)" (__imp_??0AviSink@DShowLib@@QAE@V?$basic_string@DV ?$char_traits@D@_STL@@V?$allocator@D@2@@_STL@@ABVF ilterInfoObject@1@W4tSinkModes@GrabberSinkType@1@@ Z) referenced in function "protected: void __thiscall AVIDlg::OnStartButton(void)" (?OnStartButton@AVIDlg@@IAEXXZ)
AVIDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class smart_ptr<class _STL::vector<class DShowLib::FilterInfoObject,class _STL::allocator<class DShowLib::FilterInfoObject> >,class refcount_ptr<class _STL::vector<class DShowLib::FilterInfoObject,class _STL::allocator<class DShowLib::FilterInfoObject> > > > __thiscall DShowLib::Grabber::getAvailableVideoCompressors(vo id)const " (__imp_?getAvailableVideoCompressors@Grabber@DShow Lib@@QBE?AV?$smart_ptr@V?$vector@VFilterInfoObject @DShowLib@@V?$allocator@VFilterInfoObject@DShowLib @@@_STL@@@_STL@@V?$refcount_ptr@V?$vector@VFilterI nfoObject@DShowLib@@V?$allocator@VFilterInfoObject @DShowLib@@@_STL@@@_STL@@@@@@XZ) referenced in function "protected: virtual int __thiscall AVIDlg::OnInitDialog(void)" (?OnInitDialog@AVIDlg@@MAEHXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall DShowLib::Grabber::loadDeviceState(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > const &,bool)" (__imp_?loadDeviceState@Grabber@DShowLib@@QAE_NABV ?$basic_string@DV?$char_traits@D@_STL@@V?$allocato r@D@2@@_STL@@_N@Z) referenced in function "public: void __thiscall CMainFrame::LoadPreviouslyUsedDevice(void)" (?LoadPreviouslyUsedDevice@CMainFrame@@QAEXXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > __thiscall DShowLib::Grabber::saveDeviceState(void)const " (__imp_?saveDeviceState@Grabber@DShowLib@@QBE?AV?$ basic_string@DV?$char_traits@D@_STL@@V?$allocator@ D@2@@_STL@@XZ) referenced in function "protected: void __thiscall CMainFrame::OnSettingsDevice(void)" (?OnSettingsDevice@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class smart_ptr<class _STL::vector<class DShowLib::VideoCaptureDeviceItem,class _STL::allocator<class DShowLib::VideoCaptureDeviceItem> >,class refcount_ptr<class _STL::vector<class DShowLib::VideoCaptureDeviceItem,class _STL::allocator<class DShowLib::VideoCaptureDeviceItem> > > > __thiscall DShowLib::Grabber::getAvailableVideoCaptureDevices (void)const " (__imp_?getAvailableVideoCaptureDevices@Grabber@DS howLib@@QBE?AV?$smart_ptr@V?$vector@VVideoCaptureD eviceItem@DShowLib@@V?$allocator@VVideoCaptureDevi ceItem@DShowLib@@@_STL@@@_STL@@V?$refcount_ptr@V?$ vector@VVideoCaptureDeviceItem@DShowLib@@V?$alloca tor@VVideoCaptureDeviceItem@DShowLib@@@_STL@@@_STL @@@@@@XZ) referenced in function "protected: void __thiscall CMainFrame::OnSettingsDevice(void)" (?OnSettingsDevice@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall DShowLib::Grabber::showVCDPropertyPage(struct HWND__ *,class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > const &)" (__imp_?showVCDPropertyPage@Grabber@DShowLib@@QAE_ NPAUHWND__@@ABV?$basic_string@DV?$char_traits@D@_S TL@@V?$allocator@D@2@@_STL@@@Z) referenced in function "protected: void __thiscall CMainFrame::OnSettingsImage(void)" (?OnSettingsImage@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > const & __thiscall DShowLib::VideoCaptureDeviceItem::getName(void)con st " (__imp_?getName@VideoCaptureDeviceItem@DShowLib@@Q BEABV?$basic_string@DV?$char_traits@D@_STL@@V?$all ocator@D@2@@_STL@@XZ) referenced in function "protected: void __thiscall CMainFrame::OnSettingsImage(void)" (?OnSettingsImage@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class DShowLib::Error __thiscall DShowLib::MemBuffer::save(class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > const &)const " (__imp_?save@MemBuffer@DShowLib@@QBE?AVError@2@ABV ?$basic_string@DV?$char_traits@D@_STL@@V?$allocato r@D@2@@_STL@@@Z) referenced in function "protected: void __thiscall CMainFrame::OnFileSaveimage(void)" (?OnFileSaveimage@CMainFrame@@IAEXXZ)
../../../ClassLib/debug/DemoApp_vc6.exe : fatal error LNK1120: 8 unresolved externals

Stefan Geissler
September 19, 2005, 08:31:29
Hello Petter,

I think, there must be something completly strange on your computer. The function that are not found are very old and have already been in IC Imaging 1.3.
Is it possible that other files of your Visual Studio installation are missing? I have the feeling, that the result become worth since you have reinstalled IC.
Did you perform a system check on your harddisk?

Petter Ranefall
September 19, 2005, 10:27:33
Hello Stefan.
You are right that something is strange on my computer. I tried to repair the Visual Studio 2003, but the result was the same. Then I tried the same project on an other computer and that worked fine. For the moment I will go on on the other computer and put my effort into the real problem. I will get back to you soon about that problem.

Thanks.
/Petter