User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 422,662 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,643 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 277 | Replies: 7
Reply
Join Date: Feb 2008
Posts: 9
Reputation: Sgt. Pepper is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Question Haha, Newbie question here!

  #1  
Feb 12th, 2008
Ok, no matter what compiler i use, i can never find a compiler that will build/compile/run a single file like the one I have used in my school.

i got Code::Blocks to compile my test file

the code is short:
// Test file
  1. include <iostream>
  2. int main()
  3. {
  4. cout << "yarg!" end1;
  5. return 0;
  6. }

can anyone please help me? the book I have starts off with single file programs and this is a major mountain that I keep stopping at whenever I start to read this book.

Thank You
Last edited by Ancient Dragon : Feb 12th, 2008 at 10:12 pm. Reason: add code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Location: Maryland, USA
Posts: 1,036
Reputation: Sturm is on a distinguished road 
Rep Power: 4
Solved Threads: 23
Sturm's Avatar
Sturm Sturm is offline Offline
Veteran Poster

Re: Haha, Newbie question here!

  #2  
Feb 12th, 2008
it should read: cout << "yarg!" << endl; instead.
"Hey ass, don't hijack my thread. This is serious." -JoshSCH
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,500
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 275
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Haha, Newbie question here!

  #3  
Feb 12th, 2008
And you're likely experiencing problems with the std:: namespace. Try prefixing cout and endl with std::.

Or, if you don't like doing that, just add
  1. using namespace std;
after you include <iostream>.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Feb 2008
Posts: 9
Reputation: Sgt. Pepper is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Question Re: Haha, Newbie question here!

  #4  
Feb 12th, 2008
// Test file
  1. include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "yarg!" << end1;
  6. return 0;
  7. }
No errors, yet the run, build, and other buttons of that sort are grayed and unusable.
Last edited by Ancient Dragon : Feb 12th, 2008 at 10:13 pm. Reason: add code tags
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,114
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 928
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Haha, Newbie question here!

  #5  
Feb 12th, 2008
You probably failed to create a new project. Select menu item File --> New Project, then select the Console Project icon then fill in the rest of the information. After that those buttons and menu items will be enabled.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,500
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 275
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Haha, Newbie question here!

  #6  
Feb 12th, 2008
It should be endl, not end1.

Also, you forgot to put a # symbol before 'include'. It should read:
  1. #include <iostream>
Last edited by John A : Feb 12th, 2008 at 10:21 pm.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Join Date: Feb 2008
Posts: 9
Reputation: Sgt. Pepper is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Re: Haha, Newbie question here!

  #7  
Feb 12th, 2008
Ok, now it works, i just started a new project, didnt even have to include the test file in it, but anyways thank you guys

also, how do you put the code in the special formated text thing on this forum?
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,500
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 17
Solved Threads: 275
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Haha, Newbie question here!

  #8  
Feb 12th, 2008
Use code tags. You can use [code] (code goes here) [/code] for any language, or for language-specific highlighting, you can do [code=language] (for example, [code=c++]) and of course [/code].
Last edited by John A : Feb 12th, 2008 at 10:36 pm.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:20 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC