C++ endl; compile problem?

Wizzyglvl3

New Member
Reaction score
0
I just started C++ with a book I got (C++ for DUMMIES :cool:) and I ran into a problem. I already had a problem previous to this with Dev-C++, so i switched users, and installed CodeBlocks. In the book it says to make a code with cout and endl in it, but the build log says that
error 'cout' was not declared in this scope
error 'endl' was not declared in this scope
This is the exact code
Code:
#include <iostream>
#include <cstdlib>

int main(int argc, char *argv[])
{
    cout << "Hello, I am your computer talking." << endl;
    system("PAUSE");
    return 0;
}
I don't know why its doing this, i thought it might be because this might be an outdated style (the book is probably 3 years old) or mabye its because im not using dev-C++, and something was included in the Dev-C++, (I used to do a little bit of html, so kinda like linking CSS pages to an overall HTML page, so it doesnt take up a lot of space and what not) that wasnt included in CodeBlocks
Please somebody help me troubleshoot this and see if there is anything I can do to fix it.
 

GooS

Azrael
Reaction score
154
I'm guessingyou are missing namespace.

add

using namespace std;

either just outside or inside of the main function, for local or global effect.
 

Varine

And as the moon rises, we shall prepare for war
Reaction score
805
or put std:: in front of cout (it should be std::cout << ...).
 

Wizzyglvl3

New Member
Reaction score
0
Okay thanks it works fine now
when i put std:: in front of those things it gave me a list of option things to click on after it, and i didn't know what do to so i just clicked out of it. Don't know what that was about though.
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
That thingy that popped up..
IntelliSense!
Pretty useful but notorious for being pretty.. Umm.. laggy or slow to update.

Think of it as a cheatsheet of things you might want to type at that point in time.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top