C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 28th, 2005, 03:19 PM
Serajin Serajin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 Serajin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 15 sec
Reputation Power: 0
Begginer

Hi there, im new to c++. I got a book on c++ and im using the new Visual C++ Express 2005 Beta 2.

I tried to make this program just like the book told me, but it didnt work. I'll post the source code and error.

Code:
 /* '01 Main.cpp' */ 
   
   /* Input output stream header file */ 
  #include <iostream> 
   
   /* Start */ 
  main (void) 
  { 
     std::cout << "Hello all you happy people" << std::endl; 
     return 0; 
  } 
 


Thats the source, and heres the error it gives me

Code:
 
  1>------ Build started: Project: Chapter_01, Configuration: Debug Win32 ------ 
  1>Compiling... 
  1>01 Main.cpp 
  1>e:\book\chapter_01\chapter_01\01 main.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
  1>Build log was saved at "file://e:\Book\Chapter_01\Chapter_01\Debug\BuildLog.htm" 
  1>Chapter_01 - 1 error(s), 0 warning(s) 
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 


Anyone know how i can fix this?

Thanks

Reply With Quote
  #2  
Old May 28th, 2005, 11:12 PM
ShadowCoder ShadowCoder is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: Ottawa
Posts: 20 ShadowCoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 54 m 12 sec
Reputation Power: 0
try sticking 'int ' before the main:

Code:
int main (void) 
{ 
	 std::cout << "Hello all you happy people" << std::endl; 
	 return 0; 
} 

Reply With Quote
  #3  
Old July 8th, 2005, 08:27 PM
nishivision nishivision is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 12 nishivision User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
just write return; otherwise write int before main

Reply With Quote
  #4  
Old July 12th, 2005, 08:22 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Does the example code in your book tell you to put std:: before the cout<< statement. I use visual studio 2005 beta and All I have to write is cout<<.

Reply With Quote
  #5  
Old July 18th, 2005, 09:31 PM
ubergeek ubergeek is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 600 ubergeek User rank is Private First Class (20 - 50 Reputation Level)ubergeek User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 40 m 27 sec
Reputation Power: 4
Send a message via AIM to ubergeek
you should need the std:: prefix, unless you put a using namespace std; or a using std::cout; at the top of the program...

Reply With Quote
  #6  
Old July 18th, 2005, 11:39 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 9 m 3 sec
Reputation Power: 4
Send a message via Yahoo to BloodlustShaman
i think it should be like
Code:
 #include <iostream>
 using namespace std;
 int main (void)                                           
  { 
     std::cout << "Hello all you happy people" << std::endl; 
     return 0; 
  } 

so u think u should add using namespace std;
but w/e im a newbie

Last edited by B-Con : July 19th, 2005 at 03:58 AM. Reason: added a closing [code] tag ;)

Reply With Quote
  #7  
Old July 19th, 2005, 12:46 PM
theguz theguz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 54 theguz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 40 m 34 sec
Reputation Power: 4
Try this:

#include <iostream>
using namespace std;
int main()
{
cout<< "Hello all you happy people"<< endl;
return 0;
}

I program C++ in unix and it might be different in the program you are using. Sorry if this dosen't work.

theguz

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Begginer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT