Haha, Newbie question here!

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2008
Posts: 13
Reputation: Sgt. Pepper is an unknown quantity at this point 
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Haha, Newbie question here!

 
0
  #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 11:12 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 1,066
Reputation: Sturm is on a distinguished road 
Solved Threads: 24
Sturm's Avatar
Sturm Sturm is offline Offline
Veteran Poster

Re: Haha, Newbie question here!

 
0
  #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 Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Haha, Newbie question here!

 
1
  #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>.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 13
Reputation: Sgt. Pepper is an unknown quantity at this point 
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Re: Haha, Newbie question here!

 
0
  #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 11:13 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,342
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1460
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Haha, Newbie question here!

 
0
  #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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Haha, Newbie question here!

 
0
  #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 11:21 pm.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 13
Reputation: Sgt. Pepper is an unknown quantity at this point 
Solved Threads: 0
Sgt. Pepper's Avatar
Sgt. Pepper Sgt. Pepper is offline Offline
Newbie Poster

Re: Haha, Newbie question here!

 
0
  #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 Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Haha, Newbie question here!

 
0
  #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 11:36 pm.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC