Teen Programmers Unite  
 

 

Return to forum top

file header error

Posted by csspcman [send private reply] at July 17, 2001, 10:04:20 AM

I have to include iostream.h to my programs to use classes but
the file has 102 errors. what should I do can any one help me
Iam a begginer user
tnx

Posted by grandsnafu [send private reply] at July 17, 2001, 04:50:11 PM

What is the exact error message you get?

Posted by CHollman82 [send private reply] at October 01, 2001, 10:01:36 PM

Posted by lordaerom [send private reply] at July 17, 2001, 09:29:03 PM

For DOS or console mode win32? =]

Posted by CHollman82 [send private reply] at October 01, 2001, 10:01:28 PM

Posted by gian [send private reply] at July 18, 2001, 03:39:33 AM

CHollman82: int main( void ) <-- Tidy code only, and here was me thinking you wrote a C++ tutorial... It may be frivolous, but it is tidy.

Let the large irrelivent thread begin :-]

Posted by CHollman82 [send private reply] at October 01, 2001, 10:01:47 PM

Posted by Setherd123 [send private reply] at July 18, 2001, 01:29:38 PM

CHollman82: Just because you CAN use goto doesn't mean you should, though. If there's a difference or not, it still doesn't give you the license to be stupid.

:p

Posted by Psion [send private reply] at July 18, 2001, 02:01:14 PM

Leaving out void there is just economical use of typing time.

Posted by TheTutor [send private reply] at July 19, 2001, 05:43:49 PM

Hey CHollman82 -- In your code:

int main()
{
}

You have to return something -- This would work though:

void main()
{
}

And don't use <iostream.h> -- that's the old way, instead do this:

#include <iostream>
using namespace std;

Posted by taubz [send private reply] at July 19, 2001, 09:54:01 PM

Are they compiler errors or linker errors? If they're errors while linking, it might be that you're not linking in the right C++ libraries. I had some problem with that in RH Linux a while back. I had to add -lstdc++ to the gcc arguments, which I would have assumed was automatic, but it wasn't.

If they're compilation errors, does your file name have a "cpp" extension and not a "c" extension? In MS VC++, that could be a problem.

- taubz

Posted by CHollman82 [send private reply] at October 01, 2001, 10:02:03 PM

Posted by TheTutor [send private reply] at July 20, 2001, 07:14:14 AM

Yeah you've been spoiled -- If you're going to declare a function as returning something, you should :)

Posted by lordaerom [send private reply] at July 20, 2001, 06:12:23 PM

I'd ask why it's garbage, but I don't expect a coherent answer, so I won't =]

Posted by CHollman82 [send private reply] at October 01, 2001, 10:02:17 PM

Posted by gian [send private reply] at July 21, 2001, 06:05:33 AM

CHollam82: He didn't ask!

Posted by RedX [send private reply] at August 09, 2001, 03:43:49 PM

csspcman: are you using DJGPP? This is a common problem many people had with it. Actually it's not the compiler that's the problem, it's the difference between the way dos and windows handle long filenames. (converting to classic 8.3 names I mean). Dos simply drops everything after the 8th character and after the 3th in the extension. Windows drops everthing after the 6th character and adds a ~1 to it.
The original filename is iostreams.h Dos makes it iostream.h and windows turns it into iostrea~1.h
There is a solution published at their site. You'll have to reinstall it or you can rename all the affected files.

RedX

Posted by Cobbs [send private reply] at August 09, 2001, 05:16:01 PM

ummm... you don't need to include iostream in your file to use classes... you need a C++ compiler? that could be the cause if the errors (i though we already went over this :p)

Posted by sphinX [send private reply] at August 09, 2001, 06:10:02 PM

for the djgpp problem, all you need to do is unzip all the djgpp zip files with an unzipper that likes long filenames, like winzip, all else should work fine.

Posted by lordaerom [send private reply] at August 09, 2001, 08:50:44 PM

Not to beat a dead horse, but, in current C++, as I understand it, C-style header files have been deprecated. That is why.

Posted by CHollman82 [send private reply] at October 01, 2001, 10:02:41 PM

Posted by lordaerom [send private reply] at August 09, 2001, 09:14:14 PM

Not to beat a dead horse, but, in current C++, as I understand it, C-style header files have been deprecated. That is why.

Posted by RedX [send private reply] at August 10, 2001, 02:01:23 PM

Another thing I thought about: DJGPP requires to link the stdcxx lib to use those the C++ specific things.

RedX

Posted by TheTutor [send private reply] at August 12, 2001, 12:38:59 AM

The <iostream> with out the .h gives you extra functionality that's all -- They got added when the whole concept of "namespaces" was introduced 'bout two years ago -- Eventually, you could run across compatiblity issues AND if you want to use STL (standard template library) you'll have to go the "namespace" way

Posted by CHollman82 [send private reply] at October 01, 2001, 10:02:56 PM

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.