Orwell Dev C++ won't compile or recognize my commands

I was hoping someone could help me. I get a bunch of annoying error messages when I try to compile a program

C:\Users\Public\Documents\C++ Shizzle\main.cpp In function 'int main(int, char**)':

6 1 C:\Users\Public\Documents\C++ Shizzle\main.cpp [Error] 'cout' was not declared in this scope
6 1 C:\Users\Public\Documents\C++ Shizzle\main.cpp [Note] suggested alternative:
1 0 C:\Users\Public\Documents\C++ Shizzle\main.cpp In file included from main.cpp
62 18 c:\program files (x86)\dev-cpp\mingw64\lib\gcc\x86_64-w64-mingw32\4.7.1\include\c++\iostream [Note] 'std::cout'

It won't recognize either namespace std or cout, or any other user library for that matter. What do I do to get it to let me compile a program?

Helpful replies only please
closed account (S6k9GNh0)
1. Please show a bit of code so we know what's producing the error.
2. If it's a compiler error concerning code, 99.6% (made up statistic) of the time it's your fault.
3. You probably have to either follow the warnings advice (use std::cout, not cout) or declare that you're using the namespace at the top (using namespace std;).
Last edited on
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */



int main(int argc, char** argv) {
cout << "Non working program";
return 0;

}
Last edited on
closed account (S6k9GNh0)
Right. It's not going to recognize cout because cout is in the namespace std. Also, please use code tags.

1
2
3
4
5
6
#include <iostream>

int main(int argc, char** argv) {
    std::cout << "Non working program";
    return 0;
}


or

1
2
3
4
5
6
7
8
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    cout << "Non working program";
    return 0;
}
Last edited on
Thank you so much! It works finally. And sorry for the quasi-snittiness of my previous posts. Finding helpful documentation on open source apps can be difficult at times. And not to press my luck, I had one other question.. I know stdafx.h is windows specific, so I can't use it in Dev. Is there another library or whatever that I should put in its place, and for that matter is there anywhere I can find a 'cheat sheet' of the most commonly used libraries used in Dev source code?
closed account (S6k9GNh0)
stdafx,h can be completely ignored. It is not a library or required, it's something called a precompiled header. Wiki can explain it and alternatives better than I can personally.

http://en.wikipedia.org/wiki/Precompiled_header

EDIT: Please note that even though it reduces compile times, I doubt you'll see any real noticeable improvements, even in slightly larger projects.
Last edited on
Topic archived. No new replies allowed.