• Welcome to Valhalla Legends Archive.
 

iostream problems, and compile errors for a simple program!

Started by Tron, February 20, 2004, 02:19 AM

Previous topic - Next topic

Tron

I don't know why, but i'm getting several compile errors. I'm using Borland Compiler using CMD Prompt if you must know. And also, it also says it can't find my iostream libraries... Which i've noticed are in most C++ Programs. Any help would be great, and thanks for your time!

/*
  This program displays "My First C++ Program... Isn't it great?" to the Standard Output
*/

#include <iostream>

int main ()
{
  std::cout << "My First C++ Program... Isn't it great?";
  return 0;
}

iago

This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


j0k3r

Yeah, what iago said, and you don't need "std::" in front of cout.
QuoteAnyone attempting to generate random numbers by deterministic means is, of course, living in a state of sin
John Vo

DVX

Quote from: iago on February 20, 2004, 07:05 AM
Try #include <iostream.h>

i wouldn't recomend trying to use iostream.h which avoids using the std namespace...  use iostream.  if your compiler isn't finding the libraries look at where it's looking for them at?
additionally, borland's compiler sucks..  and their linker is worse

Quote from: j0k3r on February 20, 2004, 09:01 AM
Yeah, what iago said, and you don't need "std::" in front of cout.

if you are using iostream.h then you don't have too..  but with iostream you must unless you bring cout to local or global scope where you are calling the cout stream

Skywing

Are you getting a compile-time or link-time error?

And, yes, you should use <iostream> and std::cout, not <iostream.h> + cout.

Kp

Also, you should fix your prototype for main (though I doubt that's causing problems in this particular situation).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Adron

Quote from: Tron on February 20, 2004, 02:19 AM
I don't know why, but i'm getting several compile errors. I'm using Borland Compiler using CMD Prompt if you must know. And also, it also says it can't find my iostream libraries... Which i've noticed are in most C++ Programs. Any help would be great, and thanks for your time!

Post the exact error you're getting. Perhaps you're just using an out of date Borland Compiler that doesn't have the right standard C++ libraries?

iago

Quote from: Kp on February 20, 2004, 01:36 PM
Also, you should fix your prototype for main (though I doubt that's causing problems in this particular situation).

What's wrong with his prototype for main?  Isn't int main( void ) acceptable?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Kp

Quote from: iago on February 20, 2004, 02:08 PMWhat's wrong with his prototype for main?  Isn't int main( void ) acceptable?

That's not what he wrote, and it looks wrong without regard to whether it's standard-compliant! :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Tron

Ok, so i'll post the compile errors i'm getting. Also, i'm using "Windows 2000 Professional Edition". Just in case it regards the OS which I doubt. Anyways here are the errors:

Error E2209 First.cpp 5: Unable to open include file 'iostream'

Error E2090 First.cpp 9: Qualifier 'std' is not a class or namespace name in function main()

Error E2379 First.cpp 9: Statement missing ; in function main()


Borland C++ 5.5.1 (c) 1993, 2000 Borland. And thanks for your help!

Edit: I also have Visual Studio 6.0 compiler, but it's kind of a pain to use because of the workspace you have to create... or maybe i'm just lazy.

DVX

Quote from: Tron on February 20, 2004, 04:08 PM
Ok, so i'll post the compile errors i'm getting. Also, i'm using "Windows 2000 Professional Edition". Just in case it regards the OS which I doubt. Anyways here are the errors:

Error E2209 First.cpp 5: Unable to open include file 'iostream'

Error E2090 First.cpp 9: Qualifier 'std' is not a class or namespace name in function main()

Error E2379 First.cpp 9: Statement missing ; in function main()


Borland C++ 5.5.1 (c) 1993, 2000 Borland. And thanks for your help!

Edit: I also have Visual Studio 6.0 compiler, but it's kind of a pain to use because of the workspace you have to create... or maybe i'm just lazy.

well..based on the compile errors it's not able to locate iostream, or the compiler is failing to open the file and include it in which case your compiler is probably not a good one...additionally i believe your compiler is out of date if it thinks std is not a namespace or class...check borland's website for later updates.  also, i wouldn't recomend borland anyways.  if you have microsoft's compiler, use it, IMO it's better than borland, though i would have to argue that gcc is better for more general use and linux-specific programming.

iago

Well, it can't open the file iostream so obviously it's not going to find std::.  
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

Searching a bit on the net, it seems that Borland C++ 5.5 is supposed to support iostream. Maybe you haven't created a project and set the paths correctly in your Borland C++ 5.5? You could try creating a project and setting up the include directories.

Since Borland C++ 5.5 seems to be free, I might download it and try your example out, some time, if i have nothing better to do...