Re: [vox-tech] grokking g++ errors

2006-02-02 Thread Peter Jay Salzman
On Thu 02 Feb 06,  1:12 PM, Micah J. Cowan <[EMAIL PROTECTED]> said:
> On Thu, Feb 02, 2006 at 02:59:35PM -0500, Peter Jay Salzman wrote:
> > On Thu 02 Feb 06, 10:21 AM, Jeff Newmiller <[EMAIL PROTECTED]> said:
> > > 
> > > You didn't ask for assistance in actually troubleshooting this problem, 
> > > but
> > > templates traditionally must be defined before they are instantiated in 
> > > the
> > > source.  It is possible that newer compilers can handle definition after
> > > instantiation, but I don't know how they do it.
> > 
> > Sorry for being so dense, but I'm just now starting to try to really learn
> > function and class templates.
> > 
> > Do you mean that the template function definition must be seen before the
> > any calls to the function is made (I assume that's the instantiation)?
> > 
> > I guess what I'm asking is -- is the template function's prototype not
> > enough?  The actual definition must be seen before any calls to the function
> > are made?
> 
> IIRC this should not be true (though I'll point out that in your sample
> code, no such prototype has been provided);

it was a code snipppet -- the prototypes were in an include file that i
didn't show!   :)

> Realize that defining a function /template/ does not define any
> function, only a template.  That's what /instantiating/ the template
> does. It makes it easy on the compiler if the function template's
> definition is in scope at the time you implicitly or explicitly
> instantiate it, and some compilers may require this, though the C++
> stnadard does not (only that it's in the same "translation unit"
> somewhere).
 
that's definitely a good way of putting it -- thanks!  i'll keep that in
mind.

pete
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] grokking g++ errors

2006-02-02 Thread Micah J. Cowan
On Thu, Feb 02, 2006 at 02:59:35PM -0500, Peter Jay Salzman wrote:
> On Thu 02 Feb 06, 10:21 AM, Jeff Newmiller <[EMAIL PROTECTED]> said:
> > 
> > You didn't ask for assistance in actually troubleshooting this problem, but
> > templates traditionally must be defined before they are instantiated in the
> > source.  It is possible that newer compilers can handle definition after
> > instantiation, but I don't know how they do it.
> 
> Sorry for being so dense, but I'm just now starting to try to really learn
> function and class templates.
> 
> Do you mean that the template function definition must be seen before the
> any calls to the function is made (I assume that's the instantiation)?
> 
> I guess what I'm asking is -- is the template function's prototype not
> enough?  The actual definition must be seen before any calls to the function
> are made?

IIRC this should not be true (though I'll point out that in your sample
code, no such prototype has been provided); however, for many
implementations, it is. You may also need to explicitly tell g++ to
instantiate that template into an actual function definition. Something
like:

  template void split(const string &str,
  back_insert_iterator>);

but that may not be necessary.

Realize that defining a function /template/ does not define any
function, only a template. That's what /instantiating/ the template
does. It makes it easy on the compiler if the function template's
definition is in scope at the time you implicitly or explicitly
instantiate it, and some compilers may require this, though the C++
stnadard does not (only that it's in the same "translation unit"
somewhere).

I'd be happy to help you debug the problem if you want to give me access
to the actual code.

-- 
HTH,

Micah J. Cowan
[EMAIL PROTECTED]
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] grokking g++ errors

2006-02-02 Thread Peter Jay Salzman
On Thu 02 Feb 06, 10:21 AM, Jeff Newmiller <[EMAIL PROTECTED]> said:
> 
> You didn't ask for assistance in actually troubleshooting this problem, but
> templates traditionally must be defined before they are instantiated in the
> source.  It is possible that newer compilers can handle definition after
> instantiation, but I don't know how they do it.

Sorry for being so dense, but I'm just now starting to try to really learn
function and class templates.

Do you mean that the template function definition must be seen before the
any calls to the function is made (I assume that's the instantiation)?

I guess what I'm asking is -- is the template function's prototype not
enough?  The actual definition must be seen before any calls to the function
are made?

Thanks,
pete
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] grokking g++ errors

2006-02-02 Thread Jeff Newmiller

Peter Jay Salzman wrote:

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 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  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::allocator >, std:
:allocator, std::allocator


(std::basic_string, std::allocator >


 const&, std::back_insert_iterator, std::allocator >, std::allocator, std::allocator > > > >)'
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
helpful.

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


I usually copy messes like this to an editor and indent them, which returns
some sanity to the picture when you just read off the top couple of levels
of the outline.

"In typemangled function Protoloan::initialize, there was an undefined
reference to a method 'split', templated with a back_insert_iterator,
which accepts two parameters, the first of which is a basic_string and
the second of which is a back_insert_iterator."

It would be nicer if I had a tool to do this visual parsing for me, but
I don't... the source is usually what I concentrate on.

You didn't ask for assistance in actually troubleshooting this problem, but
templates traditionally must be defined before they are instantiated in the
source.  It is possible that newer compilers can handle definition after
instantiation, but I don't know how they do it.


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::vector<
std::basic_string<
char
  , std::char_traits
  , std::allocator
>
  , std::allocator<
std::basic_string<
char
  , std::char_traits
  , std::allocator
>
>
>
>
 > (
std::basic_string<
char
  , std::char_traits
  , std::allocator
> const&
  , std::back_insert_iterator<
std::vector<
std::basic_string<
char
  , std::char_traits
  , std::allocator
>
  , std::allocator<
std::basic_string<
char
  , std::char_traits
  , std::allocator
>
>
>
>
)



--
---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


[vox-tech] grokking g++ errors

2006-02-02 Thread Peter Jay Salzman
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 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  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::allocator >, std:
:allocator, std::allocator
> > > > >(std::basic_string, std::allocator >
 const&, std::back_insert_iterator, std::allocator >, std::allocator, std::allocator > > > >)'
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
helpful.

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

Thanks!
Pete
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] Using public/private keys was [OT] Pumping a password using Expect

2006-02-02 Thread Karsten M. Self
Apologies for the late follow-up.

on Mon, Jan 09, 2006 at 10:11:11AM -0700, timriley ([EMAIL PROTECTED]) wrote:
> 
> 
> 
> -- Original Message --
> From: "Karsten M. Self" 
> Reply-To: "lugod's technical discussion forum" 
> Date:  Fri, 6 Jan 2006 12:17:22 -0800
> 
> > What learning curve?
> >
> >   # Test to see if you've got a key, if not, create one.
> >   test -f ~/.ssh/id_dsa.pub || ssh-keygen -t dsa -N "passphrase"
> >
> >   # Copy key to remote host
> >   ssh ~/.ssh/id_dsa.pub [EMAIL PROTECTED] 'mkdir .ssh; \
> >   touch .ssh/authorized_keys; chmod 600 .ssh/authorized_keys; \
> >   cat >> .ssh/authorized_keys'
> >
> >   # Test to see if ssh-agent is running, if not, start it.
> >   test [ "$SSH_AGENT_PID"x -ne x ] && ps $SSH_AGENT_PID ||
> >   eval ssh_agent
> >
> >   # enter passphrase
> >   ssh-add  
> >
> >... You've now got the ability to do stuff like:
> >
> >  ssh [EMAIL PROTECTED] 'command [; command ...]'
> >
> >... without having to enter a passphrase each time.
> 
> Thanks for a bee-line to the solution. However, the following
> errors were generated:
> 
> 1) ssh-keygen: invalid option -- t

What version of ssh-keygen and/or the SSH packages do you have?

I'm using Debian's ssh, which is really OpenSSH v2.

Read your local ssh-keygen manpage and check to see what if any options
it requires to specify keytype.  Usual keytypes are 'dsa' or 'rsa' for
version 2, or 'rsa1' for SSH version 1.


> 2) bash: ssh_agent: command not found

Should be "ssh-agent", not "ssh_agent", my typo.

> 3) ssh-add: Could not open a connection to your authentication agent.

That would be the problem of the above.  Once sorted, should work.


Peace.

-- 
Karsten M. Self http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
  The revolution will not be televised.
  You can apt-get it from the usual mirrors, however.   http://www.debian.org/


signature.asc
Description: Digital signature
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech