I cannot use STL, why ???

Started by
16 comments, last by yanuart 21 years, 4 months ago
It''s OK, I got it all fixed for good now, it seems that I haven''t include the header files.. which is weird.. I thought the compiler automatically include stdio/lib ??

anyway this bring another question.. for a standard Win32 programming which header files shoud I inculde in my code ??
Ride the thrill of your life
Play Motorama
Advertisement
I had a problem with replacing the old fstream.h to the new fstream which is also a class of STL.
when 'using namespace' it's important that there will be no old liberaries, for example:

    #include  fstream.h#include <vector>using namespace  

is bad because of a mixure of old and new libararies

instead you should write

        #include fstream.h #include <std::vector>  




[edited by - alissre on November 22, 2002 11:58:30 AM]
#include <vector>

.
.
.

std::vector myVector;

This is the correct answer.
Sorry, it seems I didnt realize that this wouldn''t let me use > or < symbols unless I wrote the HTML code thingy for it :-(
quote:Original post by alissre
I had a problem with replacing the old fstream.h to the new fstream which is also a class of STL.
when ''using namespace'' it''s important that there will be no old liberaries, for example:

#include fstream.h
#include <vector>
using namespace

is bad because of a mixure of old and new libararies

instead you should write

#include fstream.h
#include <std::vector&ht


Er, something went wrong there. fstream.h is the old deprecated header. Don''t use this unless you have to for backwards compatibility. std::vector is not a file so you can''t include it.

How about something more like this:
#include <vector>
#include <fstream>

int main
{
using namespace std;
}

500 try1

- Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
[off topic]
< = &lt;
> = &gt;



Member of the Unban Mindwipe Society (UMWS)
&amp;=&

HTTP 500 error strike 1..
just to clear things up

quote:Original post by flangazor
#include <vector>
std::vector &ltsomeType> myVector;
This is the correct answer.

Yes, this is the correct answer. Ignore other different posts.

My compiler generates one error message: "does not compile."

[edited by - alnite on November 23, 2002 4:36:34 AM]

This topic is closed to new replies.

Advertisement