public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: string
       [not found] <199802040649.BAA00309@hal2.dyn.ml.org>
@ 1998-02-04  8:14 ` H.J. Lu
  1998-02-10  9:57   ` string Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1998-02-04  8:14 UTC (permalink / raw)
  To: tudor; +Cc: egcs, Ulrich Drepper, GNU C Library

> 
> 
> Hi,
> 
> I have installed gcc-2.8.0 + libstdc++-2.8.0 + binutils-2.8.1.0.20.
> 

Are you using glibc 2? There is a known bug in libstdc++ on glibc 2
systems. We have several choices:

1. Don't make libstdc++ MT-safe, which is bad.
2. Build multilib for libstdc++, MT-safe and ST, which is very
inconvenient to build and use.
3. Modify libstdc++ to make it both MT-safe and linkable with ST
programms.

I have patches for (3). But it changes STL and people don't agree
with me on that. The current egcs has the part of my patches which
basically does (1). I'd like to see libstdc++ be fixed soon, one way
or the other.

FYI, a patch for linuxthreads is also needed. Ulrich, could you
please check it into glibc 2.0.7 and 2.1? Thanks.

> I've noticed a problem: a very simple program using `string' won't
> link.  I've seen on the newsgroups that several people experienced the
> same problem, but I couldn't find any suggestion or fix for it.  Could
> you please tell me what shall I do in order to be able to compile
> programs using the string class?
> 
> Thanks,
> Tudor
> 
> #include <string>
> 
> int
> main ()
> {
>    string s = "Hello world!\n";
> }
> 
> [tudor@hal2]:~src/misc $ c++ s.cc
> /tmp/cca002981.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >::basic_string(char const *)':
> /tmp/cca002981.o(.gnu.linkonce.t.__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0PCc+0xc): undefined reference to `basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >::nilRep'
> /tmp/cca002981.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >::assign(char const *, unsigned int)':
> /tmp/cca002981.o(.gnu.linkonce.t.assign__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0PCcUi+0x17): undefined reference to `basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >::replace(unsigned int, unsigned int, char const *, unsigned int)'
> /tmp/cca002981.o: In function `grab__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep':
> /tmp/cca002981.o(.gnu.linkonce.t.grab__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep+0xf): undefined reference to `clone__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep'
> /tmp/cca002981.o: In function `release__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep':
> /tmp/cca002981.o(.gnu.linkonce.t.release__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep+0x13): undefined reference to `__dl__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03RepPv'
> 
> 
> 


-- 
H.J. Lu (hjl@gnu.org)
---
--- sysdeps/pthread/pthread.h.orig	Mon Feb  2 09:31:30 1998
+++ sysdeps/pthread/pthread.h	Sun Feb  1 12:00:00 1998
@@ -535,8 +535,10 @@
 /* Modify the signal mask for the calling thread.  The arguments have
    the same meaning as for sigprocmask(2). */
 
+#if __sigset_t_defined
 extern int pthread_sigmask __P ((int __how, __const sigset_t *__newmask,
 				 sigset_t *__oldmask));
+#endif
 
 /* Send signal SIGNO to the given thread. */
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: string
  1998-02-04  8:14 ` string H.J. Lu
@ 1998-02-10  9:57   ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 1998-02-10  9:57 UTC (permalink / raw)
  To: H.J. Lu; +Cc: tudor, egcs, GNU C Library

hjl@lucon.org (H.J. Lu) writes:

> --- sysdeps/pthread/pthread.h.orig	Mon Feb  2 09:31:30 1998
> +++ sysdeps/pthread/pthread.h	Sun Feb  1 12:00:00 1998
> @@ -535,8 +535,10 @@
>  /* Modify the signal mask for the calling thread.  The arguments have
>     the same meaning as for sigprocmask(2). */
>  
> +#if __sigset_t_defined
>  extern int pthread_sigmask __P ((int __how, __const sigset_t *__newmask,
>  				 sigset_t *__oldmask));
> +#endif
>  
>  /* Send signal SIGNO to the given thread. */

I've now installed a more correct patch.  In signal.h sigset_t must
always be defined if __need_sigset_t is defined, even if USE_POSIX is
not defined.

-- Uli
---------------.      drepper at gnu.org ,-.    1325 Chesapeake Terrace
Ulrich Drepper  \    ,------------------'   \  Sunnyvale, CA, 94089 USA
Cygnus Solutions `--' drepper at cygnus.com  `-------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: string
  2002-03-13  1:16 string Margus Metskivi
@ 2002-03-13  1:29 ` Gerald Pfeifer
  0 siblings, 0 replies; 4+ messages in thread
From: Gerald Pfeifer @ 2002-03-13  1:29 UTC (permalink / raw)
  To: Margus Metskivi; +Cc: gcc

On Wed, 13 Mar 2002, Margus Metskivi wrote:
> What's different with g++3 when compiling a piece of code with:
> #include <string>
>
> int GetStr(string &Buffer);
>
> .
> .
> .
>
>
> with g++ everything works fine but g++3 gives errors like:
> "unexpected token string &"

You need to add

  using namespace std;

or change string to std::string;

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* string
@ 2002-03-13  1:16 Margus Metskivi
  2002-03-13  1:29 ` string Gerald Pfeifer
  0 siblings, 1 reply; 4+ messages in thread
From: Margus Metskivi @ 2002-03-13  1:16 UTC (permalink / raw)
  To: gcc

Hello

What's different with g++3 when compiling a piece of code with:
#include <string>

int GetStr(string &Buffer);

.
.
.


with g++ everything works fine but g++3 gives errors like:
"unexpected token string &"

Also, when compiling and linking code with g++3 it compiles but does not link.
Are there any additional paths needed in link-time (-L/...) and what's the
difference between g++ link and g++3 link?

Margus Metskivi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-13  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199802040649.BAA00309@hal2.dyn.ml.org>
1998-02-04  8:14 ` string H.J. Lu
1998-02-10  9:57   ` string Ulrich Drepper
2002-03-13  1:16 string Margus Metskivi
2002-03-13  1:29 ` string Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).