g++ MasterMain.o -L . -l RPC SockMessage.o SockStream.o SockAccept.o
Master.o -o master -lnsl -lsocket -lresolv
all objects above compile fine, however I get the following errors
(relating to std::map):
Undefined first referenced
symbol in file
std::_Rb_tree_increment(std::_Rb_tree_node_base*)Master.o
std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*,
std::_Rb_tree_node_base&)Master.o
std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*,
std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)Master.o
std::_Rb_tree_decrement(std::_Rb_tree_node_base*)Master.o
ld: fatal: Symbol referencing errors. No output written to master
collect2: ld returned 1 exit status
make: *** [MasterMain.o] Error 1
Other than that, I trust that you're including std::map as <map> rather
than "map"? (I don't believe that it would compile if this were true,
but just checking).
MArk
the "std::_Rb_tree_increment" is due to calling "++" on STL map iterator.
For now I'm using vectors and I don't have a problem, but it would be
nicer to use std::map.
#include <map>
#include <iostream>
using namespace std;
int main()
{
typedef std::pair <unsigned int, int> Int_Object;
std::map<unsigned int, int> m_map;
m_map.insert( Int_Object( 2, 5) );
std::map<unsigned int, int>::iterator l_itr;
for (l_itr = m_map.begin(); l_itr != m_map.end(); ++l_itr)
cout << "item = " << l_itr->first << endl;
cout << "done..." << endl;
return 0;
}
copy and paste into "test.cc"
steps to compile and run:
g++ -c test.cc
g++ test.o -o test
./test
Travis
"Alen P." <an2p...@student.cs.uwaterloo.ca> wrote in message
news:Pine.GSO.4.58.05...@cpu02.student.cs.uwaterloo.ca...