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.
kvngAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
You are using some classes (vhtIOConn, vhtDevice...) which are kept in some library. It is not enough to add h-file with these classes, you need to add also library file for linker. The way you do it depends on the compiler. For example, in VC++ you need to add library name to: Project - Settings - Link - Object/library modules.
0
AlexFMCommented:
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
0
GloomyFriarCommented:
You have to write code for the functions vhtIOConn::~vhtIOConn(void), vhtDevice::getLastUpdateTime(void), ...
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

kvngAuthor Commented:
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......
0
GloomyFriarCommented:
Firstly, you have to use or libcid.lib or msvcirt.lib - not both at the same time.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GloomyFriarCommented:
LIBCID.LIB - Single threaded, static link
MSVCIRT.LIB - Multithreaded, dynamic link (import library for MSVCI70.DLL)
0
GloomyFriarCommented:
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)
0
GloomyFriarCommented:
And some functions (__imp__glLoadIdentity, __imp__glLoadMatrixd, ...) are still undefined - you need to add some more lib files.
0
kvngAuthor Commented:
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.
0
GloomyFriarCommented:
What libraries are now connected to the project? Show me all the names.
0
kvngAuthor Commented:
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.........
0
HyperonCommented:
Can I also thank you for your help, I'ver struggled with this problem for ages!!!
0
shwetsCommented:
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
0
qwerty021600Commented:
thnx
0
qwerty021600Commented:
luv u for that
gr8t
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.