Thread: [Dev-C++] need some explanation
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Vlada D. <dj...@im...> - 2003-02-25 08:53:59
|
Hi, everybody I hope someone can explain this to me. When I write this: #include <iostream> #include <stdlib> using namespace std; I get error like "stdlib: No such file or directory". When I write like this: #include <iostream> #include <stdlib.h> using namespace std; everything is fine. I thought that with "using namespace" you don't have specify file extension. Why does the compiler complain only about stdlib without .h? Can somebody please explain this? ------------ Vlada |
|
From: Teodorescu C. <te...@xt...> - 2003-02-25 10:05:23
|
Vlada Djurovic wrote:
>Hi, everybody
>I hope someone can explain this to me. When I write this:
>
>#include <iostream>
>#include <stdlib>
>
>using namespace std;
>
>I get error like "stdlib: No such file or directory".
>When I write like this:
>#include <iostream>
>#include <stdlib.h>
>
>using namespace std;
>
>everything is fine. I thought that with "using namespace" you don't have
>specify file extension. Why does the compiler complain only about stdlib
>without .h? Can somebody please explain this?
>
>
In c++ you have libraries like <iostream> old name was <iostream.h> and
in C++ 98 standard was renamed.
on the other hand stdlib.h is not a c++ standard library is a C standard
so his name remains the same because C standard has .h names
In other words :
iostream is a C++ stadard library
stdlib.h is a C standard library
becarefull at string
<string> contains class string
<string.h> contains C like functions for manipulating strings
My sugestions:
1:Use only one set of libreries like either from C++ or from C never
mixed up especialy when you use pointers.
2:Take a look at a C++ standard and the diff betwen C and C++
|
|
From: Vlada D. <dj...@im...> - 2003-02-25 13:58:52
|
I'd like to thank everybody for help. You're great, thanks! ----- Original Message ----- From: "Teodorescu Cristian" <te...@xt...> To: "Dev-C++ Mailing List" <dev...@li...> Sent: Wednesday, September 25, 2002 10:07 AM Subject: Re: [Dev-C++] need some explanation > Vlada Djurovic wrote: > > >Hi, everybody > >I hope someone can explain this to me. When I write this: > > > >#include <iostream> > >#include <stdlib> > > > >using namespace std; > > > >I get error like "stdlib: No such file or directory". > >When I write like this: > >#include <iostream> > >#include <stdlib.h> > > > >using namespace std; > > > >everything is fine. I thought that with "using namespace" you don't have > >specify file extension. Why does the compiler complain only about stdlib > >without .h? Can somebody please explain this? > > > > > In c++ you have libraries like <iostream> old name was <iostream.h> and > in C++ 98 standard was renamed. > on the other hand stdlib.h is not a c++ standard library is a C standard > so his name remains the same because C standard has .h names > In other words : > iostream is a C++ stadard library > stdlib.h is a C standard library > becarefull at string > <string> contains class string > <string.h> contains C like functions for manipulating strings > My sugestions: > 1:Use only one set of libreries like either from C++ or from C never > mixed up especialy when you use pointers. > 2:Take a look at a C++ standard and the diff betwen C and C++ > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: <ri...@te...> - 2003-02-25 12:46:42
|
Vlada Djurovic escribió:
>Hi, everybody
>I hope someone can explain this to me. When I write this:
>
>#include <iostream>
>#include <stdlib>
>
>using namespace std;
>
>I get error like "stdlib: No such file or directory".
>When I write like this:
>#include <iostream>
>#include <stdlib.h>
>
>using namespace std;
>
>everything is fine. I thought that with "using namespace" you don't have
>specify file extension. Why does the compiler complain only about stdlib
>without .h? Can somebody please explain this?
>------------
>Vlada
>
>
>
The namespaces are used for STL (Standard Template Library) but stdlib.h
it´s a header for C library:
In a nut shell:
If you use the standard C library you must put .h for including headers
If you use STL you must not use .h and also type 'using namespace stl'
Cheers
|
|
From: <or...@vp...> - 2003-02-25 13:09:29
|
Vlada Djurovic wrote: > #include <iostream> > #include <stdlib> > using namespace std; > I get error like "stdlib: No such file or directory". > > When I write like this: > #include <iostream> > #include <stdlib.h> > using namespace std; > > everything is fine. I thought that with "using namespace" you don't have > specify file extension. No, I think this is not correct this way. I would rather say: when you don't use extensions, you MUST use namespaces. > Why does the compiler complain only about stdlib > without .h? Can somebody please explain this? The compiler complains, because there is no "stdlib" file. "stdlib.h" instead is part of C, not C++. If you look into <MINGW_DIR>/include/c++/3.2 you won't find any stdlib or stdlib.h files. It is in /include. Another little note: If you look into <MINGW_DIR>/include/c++/3.2 you will notice, that the files there don't have extensions. They have namespaces. But in <MINGW_DIR>/include/c++/3.2/backward they have extensions (kept for backward compatibility). -- Greetings, Balázs |
|
From: iad929 <ia...@jo...> - 2003-02-25 13:38:49
|
> #include <iostream> > #include <stdlib> > #include <cstdlib> Mohammed |