EOSERV Forum > Programming > c++ compiling errors
Topic is locked.
Page: << 1 >>
c++ compiling errors
Author Message
Post #195473 c++ compiling errors

std::cout << sLoaded;
Console::Out("%i", sLoaded);


map.cpp:2967:1: error: 'cout' in namespace 'std' does not name a type
map.cpp:2968:13: error: expected constructor, destructor, or type conversion before '(' token


Shouldn't I be able to use cout and Out anywhere as long as I provide the namespace?

---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
10 years, 48 weeks ago
Post #195477 Re: c++ compiling errors

#include <iostream>

You need to include the input output stream library. This is because the namespace declaration is located in the library iostream.


I however, would recommend using <stdio.h> library and using printf. 


usage declaring namespace:

#include <iostream>

using namespace std;

cout << "blah";


other way

#include <iostream>

std::cout << "blah";


---
I forgot what I was going to write...
10 years, 48 weeks ago
Post #195482 Re: c++ compiling errors
Jimbo posted: (9th Feb 2014, 07:53 pm)

#include <iostream>

You need to include the input output stream library. This is because the namespace declaration is located in the library iostream.


I however, would recommend using <stdio.h> library and using printf. 


usage declaring namespace:

#include <iostream>

using namespace std;

cout << "blah";


other way

#include <iostream>

std::cout << "blah";



thanks but that's not it. it's because I put it outside of an initializer.



FUCK YESSSSSSSSSSSSSSSSSSSSSSSSSSSSS HHAHAHHAHAHAHAAAHHAAAHAHAHA I DID IT!
---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
10 years, 47 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Programming > c++ compiling errors