l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2006 Feb 02 10:21

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] grokking g++ errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] grokking g++ errors

I've always had a hard time parsing g++'s verbose error messages.  For
example, this code (in ProtoLoan.cc):

// We've been passed a line of a csv file.  We'll parse that line and place
// it in a vector so we can populate the protoloan.
void ProtoLoan::initialize( const string &str )
   vector<string> fields;
   split( str, back_inserter(fields) );

// Takes a string and a container.  Splits the string based on comma
// separated fields and places each element into the container.  The
// container is defined as a template, so we can use vectors, lists, etc.
template <class Out> void split( const string &str, Out os )
   typedef string::const_iterator iter;

   iter i = str.begin();
   while ( i != str.end() )
      i = find_if( i, str.end(), not_comma );

      // Find end of next word
      iter j = find_if( i, str.end(), is_comma );

      // Copy characters in [i, j)
      if ( i != str.end() )
         *os++ = string(i,j);
      i = j;

Produces this error message:

$ make
g++  -W -Wall -g3  -c -o rmbs.o rmbs.cc
g++  -W -Wall -g3  -c -o protoloan.o protoloan.cc
g++  rmbs.o protoloan.o -o rmbs
protoloan.o: In function `_ZN9ProtoLoan10initializeERKSs':
/cygdrive/c/Documents and Settings/psalzman/home/RMBS/code/C++/protoloan.cc:19:
undefined reference to `void ProtoLoan::split<std::back_insert_iterator<std::vec
tor<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std:
:allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>
> > > > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >
 const&, std::back_insert_iterator<std::vector<std::basic_string<char, std::char
_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, st
d::char_traits<char>, std::allocator<char> > > > >)'
collect2: ld returned 1 exit status
make: *** [rmbs] Error 1

My mind reels trying to parse this.  I understand that split() isn't being
found by the linker, for some reason, but the rest of the message isn't too

Is there a way to glean more information from the error message other than
the fact that the function isn't being found?

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.