Solved

linking errors while compiling c++ console application

Posted on 2003-11-06
4
1,024 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

861 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

24 Experts available now in Live!

Get 1:1 Help Now