Turbo C++ and Code blocks

c++, codeblocks, namespaces, program-entry-point, turbo-c++

Solution

Possibly you worked on a very old version of compiler that doesn't implement the `C++` specifications completely or in other words it is not conformant to `C++`. An old version written during dos era may allow you to do many nasty/non-standard things.

In `C++` entire C++ standard library is defined within `namespace std`. You must use `using` and/or fully qualified name (with scope resolution) to access these.

`main` in C++ must return an `int` with either of the 2 signatures

int main();
int main(int argc, char *argv[]);

In short for your use cases `turbo C++` is doing wrong while `Codeblocks` is correct.

Problem

Why should I use namespaces and int main in Code blocks while there are no namespaces in turbo c++ and I can use void main without returning any value as I learnt in schools. Is the compiler different, Is the C++ version different?

Original source

Related problems