Mail Archives: djgpp/2000/12/05/01:21:45
In comp.os.msdos.djgpp Ron House <house AT usq DOT edu DOT au> wrote:
> Bart Kowalski wrote:
>>
>> > An example of a line it won't compile is:
>> >
>> > vector<vector<int> > m;
>> >
>> > as found on page 836 of Stroustrup.
>>
>> You forgot the namespace qualifier. See chapter 8 of the same book.
>
> Oops! So did Stroustrup. (See all examples of the STL between pp1-900.)
> :-)
No, he didn't.
"For simplicity, I will rarely use the std:: prefix explicitly in
examples. Neither will I always #include the necessary headers
explicitly. To compile and run the program fragments here, you must
#include the appropriate headers (as listed in $3.7.5, $3.8.6, and
Chapter 16). In addition, you must either use the std:: prefix or make
every name from std global ($8.2.3)." (p.47)
I strongly recommend you read chapters 2 and 3 twice before proceeding,
to make sure you've thoroughly digested everything at a general level.
It's an excellent book and well worth reading cover-to-cover.
> Seriously, no, that doesn't fix it. Besides, the error is not a simple
> undeclared identifier, but a series of messages referring to lines deep
> in the STL code:
I myself can make no sense whatsoever of gcc's error messages. They
know their errors are cryptic and often even misleading, but they've
given a higher priority to getting correct code working than correctly
diagnosing broken code.
Please look at gcc's webpage and see if you should report this as a bug
or not.
> Adding or removing "std::", or inserting "using namespace std" changes
> the error not one iota. As far as I can tell, any declaration of the
> form: "a<b<c> > d;", where a and b are STL containers, fails to compile
> no matter what you do with namespaces.
What version of gcc are you using precisely? I use 2.95.2 and have no
such problems. Rather, I have the problem of incredibly long compile
times when I use templates of templates :-)
--
naisbodo AT enteract DOT com
http://www.naisbodo.com/
- Raw text -