Solved

linking errors while compiling c++ console application

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

792 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