GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Nov-2008, 13:46
Dunpar Dunpar is offline
New Member
 
Join Date: Nov 2008
Location: CA
Posts: 3
Dunpar is on a distinguished road

Hello World not working


hello guys im using the C++builderX from Borland version 1.0.0.1786

im trying to do the helloworld thing... i dont know what i am doing wrong..

CPP / C++ / C Code:
#include <iostream>

 int main();
 int main()
 {
  std::count << "hello world i am here!\n";
  return 1;
 }

....lol unforintly i have messed up and i dont even know how to get the errors that i was geting... i have 1 hr on this program so pls be gentle....

personley i think i need to compile it but i dont know how to do that wiht this program... i am at a loss.
  #2  
Old 09-Nov-2008, 14:26
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 580
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: newbee question


It is std::cout, not std::count.

Neither it a prototype for main() required. Normal termination returns 0, not 1.
  #3  
Old 09-Nov-2008, 14:33
Dunpar Dunpar is offline
New Member
 
Join Date: Nov 2008
Location: CA
Posts: 3
Dunpar is on a distinguished road

Re: newbee question


CPP / C++ / C Code:
#include <iostream>

int main();
int main()
{
std::cout << "hello world i am here!\n";
return 1;
}

ok i fixed it but now i am geting errors like this....

Code:
bcc32 -g100 -j25 -O2 -k- -vi -tWC -c -IC:\CBuilderX\include -o"C:\Documents and Settings\user\cbproject\ConsoleApp4\windows\Release_Build\File1.obj" File1.c Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland File1.c: "_mbstate.h": E2257 , expected at line 52 "type_traits.h": E2453 Size of the type '__true_type' is unknown or zero at line 64 "type_traits.h": E2453 Size of the type '__false_type' is unknown or zero at line 65 "type_traits.h": E2141 Declaration syntax error at line 68 "type_traits.h": E2141 Declaration syntax error at line 70 "type_traits.h": E2141 Declaration syntax error at line 73 "type_traits.h": E2141 Declaration syntax error at line 77 "type_traits.h": E2141 Declaration syntax error at line 82 "type_traits.h": E2141 Declaration syntax error at line 89 "type_traits.h": E2141 Declaration syntax error at line 90 "type_traits.h": E2141 Declaration syntax error at line 98 "type_traits.h": E2141 Declaration syntax error at line 107 "type_traits.h": E2141 Declaration syntax error at line 174 "type_traits.h": E2141 Declaration syntax error at line 200 "type_traits.h": E2141 Declaration syntax error at line 201 "type_traits.h": E2141 Declaration syntax error at line 204 "type_traits.h": E2141 Declaration syntax error at line 209 "type_traits.h": E2141 Declaration syntax error at line 210 "type_traits.h": E2141 Declaration syntax error at line 213 "type_traits.h": E2141 Declaration syntax error at line 224 "type_traits.h": E2141 Declaration syntax error at line 226 "type_traits.h": E2141 Declaration syntax error at line 228 "type_traits.h": E2141 Declaration syntax error at line 230 "type_traits.h": E2141 Declaration syntax error at line 232 "type_traits.h": E2141 Declaration syntax error at line 235 "type_traits.h": E2228 Too many error or warning messages at line 235 *** 26 errors in Compile *** BCC32 exited with error code: 1 Build cancelled due to errors
Last edited by admin : 09-Nov-2008 at 23:46. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #4  
Old 09-Nov-2008, 14:41
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: newbee question


Put this at the top (below #include <iostream>)

CPP / C++ / C Code:
using namespace std;

EDIT: Oops, I just noticed that you said std::cout, so the above change won't make a difference. I tried compiling the code you posted and it works fine.
__________________
www.blake-foster.com
  #5  
Old 09-Nov-2008, 14:54
Dunpar Dunpar is offline
New Member
 
Join Date: Nov 2008
Location: CA
Posts: 3
Dunpar is on a distinguished road

Re: newbee question


are you using the same program that i am... i think that i am trying to run the program instead of compiling it and linking it.... i dont know how to compile it... ...

also i tryed the change you said and it still gives same errors... any suggestions... any compilers you suggest... any newbee guilds... right now im using sams teach yourself C++ in 24 hrs... it came with the Program and i dont know if that is the best thing for me.
  #6  
Old 09-Nov-2008, 17:50
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 580
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: newbee question


Quote:
Originally Posted by Dunpar
i think that i am trying to run the program instead of compiling it and linking it....
In practice, C++ is a compiled language -- which means that anyone using the language will need to create source code in a text file followed by compiling it with a compiler followed by linking all appropriate object files & necessary libraries with a linker into the resulting executable. If you are writing the code for an application, it must be compiled & linked. Other languages such as Python, Perl, & Ruby are interpreted which means that source code is converted into a form that the interpreter can then execute each time the script is executed.
Quote:
i dont know how to compile it...
My suggestion is to begin studying the help files found (most likely...) by pressing F1.
  #7  
Old 09-Nov-2008, 21:56
n00pster n00pster is offline
Junior Member
 
Join Date: Sep 2008
Location: Miami
Posts: 40
n00pster will become famous soon enough

Re: newbee question


There are hundreds of good C++ books, why don't you start with C++ primer by stephen prata and follow up with scott meyers effective C++ :-)

I would suggest that you use eclipse CDT if you are in linux and VC++ 2008 if your are on windows. Step through code, take a look at assembly code.
Best of luck guys.
  #8  
Old 10-Nov-2008, 08:34
bcompt143 bcompt143 is offline
Awaiting Email Confirmation
 
Join Date: Apr 2008
Posts: 22
bcompt143 is on a distinguished road

Re: Hello World not working


hey first of all, you have to insert ".h" when you including input output stream then, the main function does not need declaration when you want to us, so remove int main();
CPP / C++ / C Code:
#include<iostream.h>
int main( )
{
   cout<<"hello world";
   return 0;
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please, This is Difficult question try for me! bcompt143 C++ Forum 4 24-Aug-2008 10:14
Problems about simple tricked loop question allenfanwenyuan C++ Forum 6 01-May-2007 10:19
Question about locking surfaces to directly access pixels, SDL. george89 C++ Forum 0 18-Jun-2006 22:16
Question about sprintf() shvalb C Programming Language 1 23-Feb-2005 05:28
question of practice magiccreative C++ Forum 1 06-Feb-2004 08:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:57.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.