954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Haha, Newbie question here!

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

include <iostream>
int main()
{
    cout << "yarg!" end1;
return 0;
}


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 :cool:

Sgt. Pepper
Light Poster
31 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

it should read: cout << "yarg!" << endl; instead.

Sturm
Veteran Poster
1,079 posts since Jan 2007
Reputation Points: 343
Solved Threads: 24
 

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

using namespace std;

after you include .

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

// Test file

include <iostream>
using namespace std;
int main()
{
    cout << "yarg!" << end1;
return 0;
}

No errors, yet the run, build, and other buttons of that sort are grayed and unusable.

Sgt. Pepper
Light Poster
31 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

It should be endl, not end1.

Also, you forgot to put a # symbol before 'include'. It should read:

#include <iostream>
John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

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?

Sgt. Pepper
Light Poster
31 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

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].

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You