Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

linking problem?

1 view
Skip to first unread message

Alen P.

unread,
Nov 1, 2005, 9:47:44 PM11/1/05
to
Here is a line from my make file to create master executable:

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

Mark Groves

unread,
Nov 2, 2005, 12:13:40 AM11/2/05
to
Hmmm....well, one thing that I notice is that you have "-l RPC" and it
should probably be -lRPC (well, really -lrpc), same thing with "-L ." .

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

Alen P.

unread,
Nov 2, 2005, 12:36:15 PM11/2/05
to

the spaces don't matter, I've changed "RPC" to "rpc" same as assignment
requirement.

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.

Alen P.

unread,
Nov 2, 2005, 1:06:44 PM11/2/05
to

here is sample program to replicate the problem:

#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 Allen

unread,
Nov 3, 2005, 10:30:12 AM11/3/05
to Alen P.
that compiles, links, and runs for me on the UW CS servers...


Travis

Donald Ho

unread,
Nov 6, 2005, 9:36:56 PM11/6/05
to
Having the same problem here, anyone come across a solution to this other
than not using maps?

"Alen P." <an2p...@student.cs.uwaterloo.ca> wrote in message
news:Pine.GSO.4.58.05...@cpu02.student.cs.uwaterloo.ca...

0 new messages