Solved

linking errors while compiling c++ console application

Posted on 2003-11-06
4
1,023 Views
Last Modified: 2013-12-14
I am getting following linking errors while compiling console application ...any ideas ?

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(unsigned long)" (??6?$basic_ostream@DU?$char_traits@D
@std@@@std@@QAEAAV01@K@Z) already defined in protocol.obj

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??6std@@YAAAV?$basic_ostream@DU?$cha
r_traits@D@std@@@0@AAV10@PBD@Z) already defined in network.obj

network.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> >  std::cerr" (?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)

protocol.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> >  std::cerr" (?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)

revnetwork.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> >  std::cerr" (?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)

protocol.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> >  std::cout" (?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)

protocol.obj : error LNK2001: unresolved external symbol "private: static int  std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)

rawpacket.obj : error LNK2001: unresolved external symbol "private: static int  std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)

revnetwork.obj : error LNK2001: unresolved external symbol "private: static int  std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)

sock.obj : error LNK2001: unresolved external symbol _errno
0
Comment
Question by:nrusinh
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 50 total points
ID: 9693904
The error LNK 2001 is either because you're missing the implementation of those functions or the definition of those variables.
To solve this, check that you have implemented those functions and defined those variables.

The error LNK 2005 is because the linker is findind 2 implementations for the same function and can't decide which one is the one that should be using. To solve this check that you have only one implementation for each function.

Hope this helps

Tincho

0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9694297
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10242573
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: tinchos {http:#9693904}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now