Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-25-2004, 05:22 PM   #1 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
Ahhhhhhh!

i just installed borland, and tried compiling the demo progam in there.

Code:
#include <iostream.h> 

int main() {
  cout<<"Hello World! ";
  return 0;
}
But every time i try to compile it, i get these two errors:
Error E2209 C:\prog1\prog1.cpp 1: Unable to open include file 'iostream.h'
Error E2451 C:\prog1\prog1.cpp 4: Undefined symbol 'cout' in function main()
*** 2 errors in Compile ***

What the hell is going on?
falsepride is offline   Reply With Quote
Old 12-26-2004, 12:37 AM   #2 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
First off, your <iostream.h> should be <iostream>. The .h is used for your C. As for your cout, you need to add 'using namespace std;' below your iostream line. This allows you to use 'std::cout' without having to add the std:: in front of it.
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-26-2004, 07:48 AM   #3 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
now im getting 3 errors. and i didnt write this crappy program, its in the c++ tutorial on this site. The Borlan C++ compiler #1. That tutorial completly sucks if the code in it doesnt work, and it doesnt even tell you how to compile your programs after making them. can someone help me out with this?
falsepride is offline   Reply With Quote
Old 12-26-2004, 08:35 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
'3 errors' doesn't tell anyone much to help you out with. as with most debug help, i recommend posting a copy of your code and the error.

on another note, here's a hello world tutorial that i wrote. you may want to give this code a try: http://cpp.codenewbie.com/articles/c...ld-Page_1.html
__________________
Mike
sde is offline   Reply With Quote
Old 12-26-2004, 09:27 AM   #5 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
im still getting the 3 god damn errors, maybe i installed borland wrong but the path to it is C:\Borland\BCC55 and i run command prompt and type in bcc32 C:\prog1.cpp the path to my .cpp file and i get these three god damn errors:

Error E2209 C:\prog1.cpp 1: Unable to open include file 'iostream'
Error E2282 C:\prog1.cpp 2: Namespace name expected
Error E2451 C:\prog1.cpp 6: Undefined symbol 'cout' in function main()
*** 3 errors in Compile ***
falsepride is offline   Reply With Quote
Old 12-26-2004, 11:51 PM   #6 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
I'm not completely sure if the Borland syntax is somewhat different from ANSI, but this is what worked for me:

Quote:
#include <iostream>
using namespace std;

int main()
{
cout << "Hello World!";
return 0;
}
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-27-2004, 12:05 AM   #7 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
BTW, you can always install the GNU compiler (Free also).
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-27-2004, 08:55 AM   #8 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
You most likely need to configure your Borland properly. I don't use it so I can't tell how, but I am sure you have somehwere an installation guide or a readme file.
Perhaps this link is usefull as well:
http://cplus.about.com/od/compilersa.../aa031502a.htm

Another option is to install DevCPP 5. It's visual debugger is somwhat buggy (how ironic ) but otherwise the compiler meets the latests standards and you don't have to depend on commandline based compiling and debugging.
__________________
Valmont is offline   Reply With Quote
Old 12-27-2004, 10:19 AM   #9 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
Yea i found out i needed to do some extra installation steps in the read me file. the borland free C++ compiler #1 article on this site, needs some editing. i was using that as my guide, and it caused more problems than it helped.
falsepride is offline   Reply With Quote
Old 01-16-2005, 09:16 PM   #10 (permalink)
Maani
Registered User
 
Join Date: Jan 2005
Posts: 10
Maani is on a distinguished road
Question Namespace name expected !

YeaH,

well i've just installed C++ Builder professional .. got a little tutorial that says:

#include <iostream>
using namespace std;

int ()
{

cout << "YeaH\n";
}

But when i compile it i get an error saying "Namespace name expected"
i thought this coding might be wrong so i checked another similiar program .. but it's all the same ..

Any Idea why ?
Thanks.
Maani is offline   Reply With Quote
Old 01-16-2005, 09:19 PM   #11 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
i couldnt tell you much, but instead of "using namespace std;" try "using std::cout;"
falsepride is offline   Reply With Quote
Old 01-16-2005, 09:29 PM   #12 (permalink)
Maani
Registered User
 
Join Date: Jan 2005
Posts: 10
Maani is on a distinguished road
Naah :(

Quote:
Originally Posted by falsepride
i couldnt tell you much, but instead of "using namespace std;" try "using std::cout;"
it's showing error .. it says :
Qualifier "std" is not a class or namespace name
Identifier expected.

fella if the "using namespace std" aint incorrect then why it's showing error .. that's the real prob .. if i use any alternative to that .. i wont be able to understand this namespace ever Anyways thanks for the reply fella ..
i hope someone more experienced cud help us out.

Peace.
Maani is offline   Reply With Quote
Old 01-17-2005, 12:36 AM   #13 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Once again, try DevCPP 5:
http://www.bloodshed.net/devcpp.html
A new version is out that removes quite a few bugs.
__________________
Valmont is offline   Reply With Quote
Old 01-17-2005, 05:21 AM   #14 (permalink)
mymy828
Registered User
 
Join Date: Oct 2004
Location: China
Posts: 2
mymy828 is on a distinguished road
I think you maybe need to unistall that and install again.Maybe there was something wrong when installes it.My Dev C++ 4.9 can run that .
mymy828 is offline   Reply With Quote
Old 01-18-2005, 02:53 PM   #15 (permalink)
[OCS]Midnight
Registered User
 
Join Date: Jan 2005
Posts: 2
[OCS]Midnight is on a distinguished road
All I know is that a lot of Borlan C++ is different from most other C++ compiling. For instance, in a Borlan program you'd say

#include <iostream.h>

int main()
{
cout <<"Hello World !";
return 0;
}

However, with most other compilers this won't work(As I'm finding out right now after downloading the Dev-C++ compiler and trying to use "Borlan-type" code.)

And all this info. may not even be related to what you guys are talking about however it might help in some way :o Just thought I'd add what little I know.
[OCS]Midnight is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:56 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting