c++/4626

Chris Rankin rankincj@yahoo.com
Sat Oct 20 20:48:00 GMT 2001


Preprocessed source is irrelevant here. You will need
a compiler with the following configuration:

$ g++ -v
Reading specs from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: ../gcc-3.0.1/configure --prefix=/usr
--enable-shared --enable-nls --enable-threads=posix
--enable-version-specific-runtime-libs
Thread model: posix
gcc version 3.0.1

The rest is just ANY code that uses "-frepo". I
knocked this trivial example together in 5 minutes
flat:

-- Makefile----------------------------------
SRC=bug_stl.cpp main.cpp
OBJ=$(SRC:.cpp=.o)

BINARIES=bug

bug: $(OBJ)
  $(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ $^

.PHONY: clean

clean:
  $(RM) *.o *.rpo $(BINARIES)

%.o: %.cpp
  $(CXX) $(CXXFLAGS) -frepo -c $< -o $@


-- bug_stl.h -----------------------------
#ifndef BUG_STL_H
#define BUG_STL_H

void any_old_template_crap();

#endif

-- bug_stl.cpp ---------------------------
#include <vector>
#include <string>
using namespace std;

#include "bug_stl.h"

typedef vector<string>  VECTOR;


void
any_old_template_crap()
{
  VECTOR  v;

  for (int i = 0; i < 100; ++i)
  {
    v.push_back("FOR FUCK'S SAKE!");
  } /* for */
}

-- main.cpp ---------------------------------
#include "bug_stl.h"

int
main()
{
  any_old_template_crap();
  return 0;
}

----------------------------------------------
Then you type "make":

$ make
g++  -frepo -c bug_stl.cpp -o bug_stl.o
g++  -frepo -c main.cpp -o main.o
g++   -o bug bug_stl.o main.o
collect: recompiling bug_stl.cpp
In file included from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/g++/bits/std_cstring.h:37,
                 from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/g++/bits/stl_algobase.h:71,
                 from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/g++/bits/std_vector.h:62,
                 from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/g++/vector:31,
                 from bug_stl.cpp:1:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/g++/bits/std_cstddef.h:38:25:
stddef.h: No such file or directory

You can work around by copying those include files
into /usr/i686-pc-linux-gnu/include:

$ make clean
rm -f *.o *.rpo bug
$ ls -als /usr/i686-pc-linux-gnu/include/
total 24
   4 drwxr-xr-x    2 root     root         4096 Oct 20
20:47 .
   4 drwxr-xr-x    5 root     root         4096 Jul 22
 2000 ..
   4 -rw-r--r--    1 root     root         3554 Oct 20
12:49 limits.h
  12 -rw-r--r--    1 root     root        11242 Oct 20
12:45 stddef.h
$ make
g++  -frepo -c bug_stl.cpp -o bug_stl.o
g++  -frepo -c main.cpp -o main.o
g++   -o bug bug_stl.o main.o
collect: recompiling bug_stl.cpp
collect: relinking
collect: recompiling bug_stl.cpp
collect: relinking

Ta Da!

Chris


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com



More information about the Gcc-bugs mailing list