Link to home
Start Free TrialLog in
Avatar of kvng
kvng

asked on

error Lnk2001: unresolved external symbol

Hi,

I have a linking problem after attempting to build the file. The error is as follows:

glovenew.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall vhtIOConn::~vhtIOConn(void)" (??1vhtIOConn@@UAE@XZ)
glovenew.obj : error LNK2001: unresolved external symbol "public: double __thiscall vhtDevice::getLastUpdateTime(void)" (?getLastUpdateTime@vhtDevice@@QAENXZ)
glovenew.obj : error LNK2001: unresolved external symbol "public: __thiscall vhtTracker::vhtTracker(class vhtIOConn *,bool)" (??0vhtTracker@@QAE@PAVvhtIOConn@@_N@Z)
glovenew.obj : error LNK2001: unresolved external symbol "public: __thiscall vhtCyberGlove::vhtCyberGlove(class vhtIOConn *,bool)" (??0vhtCyberGlove@@QAE@PAVvhtIOConn@@_N@Z)
glovenew.obj : error LNK2001: unresolved external symbol "public: __thiscall vhtIOConn::vhtIOConn(char const *,char const *,char const *,char const *,char const *)" (??0vhtIOConn@@QAE@PBD0000@Z)
Debug/glovenew.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.


Could anyone tell me what is wrong and how to go about solving it? Thanks.
SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlexFM
AlexFM

If all these classes belong to your own project, this means that you didn't implement number of functions:

vhtIOConn::~vhtIOConn
vhtDevice::getLastUpdateTime
...

For example:

class a
{
    A();           // only declaration, no implementation
};

// client.cpp

...
A a;          // compiles, but produces linker error: A::A is not implemented
You have to write code for the functions vhtIOConn::~vhtIOConn(void), vhtDevice::getLastUpdateTime(void), ...
Avatar of kvng

ASKER

After adding the appropriate library modules, i get the following errors:

msvcirt.lib(MSVCIRT.dll) : error LNK2005: "public: virtual __thiscall ios::~ios(void)" (??1ios@@UAE@XZ) already defined in libcid.lib(_ios.obj)
msvcirt.lib(MSVCIRT.dll) : error LNK2005: "public: class ostream & __thiscall ostream::operator<<(unsigned char)" (??6ostream@@QAEAAV0@E@Z) already defined in libcid.lib(ostrchar.obj)
msvcirt.lib(MSVCIRT.dll) : error LNK2005: "public: class ostream & __thiscall ostream::operator<<(char const *)" (??6ostream@@QAEAAV0@PBD@Z) already defined in libcid.lib(ostream.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strchr already defined in LIBCD.lib(strchr.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in LIBCD.lib(sprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fflush already defined in LIBCD.lib(fflush.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _getenv already defined in LIBCD.lib(getenv.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glLoadMatrixd@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glNormal3dv@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glEnd@0
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glVertex3dv@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glBegin@4
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/glovenew.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.


Could you suggest how i could resolve this conflict for these errors? Thanks......
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
LIBCID.LIB - Single threaded, static link
MSVCIRT.LIB - Multithreaded, dynamic link (import library for MSVCI70.DLL)
The same with LIBCD.lib and MSVCRT.lib.

MSVCRT.LIB - Multithreaded, dynamic link (import library for MSVCR70.DLL).
LIBCD.LIB - Single-threaded, static link (debug)
And some functions (__imp__glLoadIdentity, __imp__glLoadMatrixd, ...) are still undefined - you need to add some more lib files.
Avatar of kvng

ASKER

After resolving the library issues and adding the appropriate libraries, i still get the following errors. Please help? Thanks

Linking...
glovenew.obj : error LNK2001: unresolved external symbol "class ostream_withassign cerr" (?cerr@@3Vostream_withassign@@A)
glovenew.obj : error LNK2001: unresolved external symbol "public: static int const filebuf::openprot" (?openprot@filebuf@@2HB)
glovenew.obj : error LNK2001: unresolved external symbol "class istream_withassign cin" (?cin@@3Vistream_withassign@@A)
glovenew.obj : error LNK2001: unresolved external symbol "class ostream_withassign cout" (?cout@@3Vostream_withassign@@A)
libVHTDevice.lib(vhtIOConn.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::ios_base::Init::Init(void)" (__imp_??0Init@ios_base@std@@QAE@XZ)
libVHTDevice.lib(vhtIOConn.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::ios_base::Init::~Init(void)" (__imp_??1Init@ios_base@std@@QAE@XZ)
libVHTDevice.lib(vhtIOConn.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Winit::_Winit(void)" (__imp_??0_Winit@std@@QAE@XZ)
libVHTDevice.lib(vhtIOConn.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Winit::~_Winit(void)" (__imp_??1_Winit@std@@QAE@XZ)
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glLoadMatrixd@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glNormal3dv@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glEnd@0
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glVertex3dv@4
libVHTDevice.lib(vhtOglDrawer.obj) : error LNK2001: unresolved external symbol __imp__glBegin@4
glovenew___Win32_Debug/glovenew.exe : fatal error LNK1120: 14 unresolved externals
Error executing link.exe.
What libraries are now connected to the project? Show me all the names.
Avatar of kvng

ASKER

Hi,

i've managed to solve the problem. It appears that the toolkit i'm using requires the Code generation to be set to 'dll multi-threaded debug' mode and that has been causing the problem.

Thank you for the help.........
Can I also thank you for your help, I'ver struggled with this problem for ages!!!
Hi

I am trying to use Log4cxx in my source code . All i got was a set of header files for this api ... which I have included in my source and it compiles fine . But it gives a linker error mentioned below. Do I need to register some dll for Log4cxx or just including the header files is enuff' . Also The code generation is set to debug multi threaded dll .

Following is the error that i am getting. Any help would be appreciated.

evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::forcedLog(class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const &,class std::basic_string<char,struct std::char_traits<cha
r>,class std::allocator<char> > const &,char const *,int)" (__imp_?forcedLog@Logger@log4cxx@@QAEXABV?$ObjectPtrT@VLevel@log4cxx@@@helpers@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall log4cxx::Logger::isInfoEnabled(void)const " (__imp_?isInfoEnabled@Logger@log4cxx@@QBE_NXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const  log4cxx::Level::INFO" (__imp_?INFO@Level@log4cxx@@2V?$ObjectPtrT@VLevel@log4cxx@@@helpers@2@B
)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::FileAppender::setFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?setFile@Fil
eAppender@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall log4cxx::FileAppender::FileAppender(void)" (__imp_??0FileAppender@log4cxx@@QAE@XZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::Class const & __cdecl log4cxx::Appender::getStaticClass(void)" (__imp_?getStaticClass@Appender@log4cxx@@SAABVClass@helpers@2@XZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class log4cxx::helpers::Class const & __thiscall log4cxx::FileAppender::getClass(void)const " (__imp_?getClass@FileAppender@log4cxx@@UBEABVClass@helpers@2@X
Z)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::FileAppender::`vbase destructor'(void)" (__imp_??_DFileAppender@log4cxx@@QAEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::addRef(void)const " (__imp_?addRef@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::releaseRef(void)const " (__imp_?releaseRef@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::lock(void)const " (__imp_?lock@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::unlock(void)const " (__imp_?unlock@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::wait(void)const " (__imp_?wait@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::notify(void)const " (__imp_?notify@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cxx::helpers::ObjectImpl::notifyAll(void)const " (__imp_?notifyAll@ObjectImpl@helpers@log4cxx@@UBEXXZ)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall log4cxx::FileAppender::instanceof(class log4cxx::helpers::Class const &)const " (__imp_?instanceof@FileAppender@log4cxx@@UBE_NABVClass@helpe
rs@2@@Z)
evapp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void const * __thiscall log4cxx::FileAppender::cast(class log4cxx::helpers::Class const &)const " (__imp_?cast@FileAppender@log4cxx@@UBEPBXABVClass@helpers@
2@@Z)
EVPricingService___Win32_Console_Debug/EVPricingService.exe : fatal error LNK1120: 17 unresolved externals
luv u for that
gr8t