I began to learn the C ++ language, downloaded the Dev-C ++ program for compiling and the book “Master C ++ in 21 days”. In the book, the code of the type of my first program is written, I rewrote it, by the way it is:

#include <iostream.h> int main() { cout << "Hello World!\n"; return 0; } 

Further I compile, but the error is produced:

32: 2 F: \ Dev-Cpp \ include \ c ++ \ 3.4.2 \ backward \ backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C ++ standard. C ++ for the header of the deprecated header. To disable this warning use -Wno-deprecated.

I click to execute, but to me in response: “the project is not compiled”.

Where is the source of the error? Maybe something is wrong with the code?

  • my advice to you, buy the book Herbert Shildt - with ++. A beginner's guide. It is quite simple. There will be more benefits than yours and there will be no such questions - G71
  • Examine the development environment, its features; each with its own bells and whistles, and the program is written correctly. Good luck. :) - Ivan 741

4 answers 4

Write:

 #include <iostream> 

and further

 using namespace std; 

Apparently, your book is quite old (and, in general, "... in 21 days" always scare me)

The code should take, for example, the following form:

 #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } 

PS If you have questions why, ask, we will answer.

  • ha, thanks, I wrote the code like this, everything is correct, but for some reason my program does not start, the window quickly opens and immediately closes, I don’t have time to do anything, and on behalf of the administrator I started, it blinks and everything, help plizz) - MCneposeda
  • one
    This is a console application. Or set it in the properties of the application so that the window does not close on completion or run from the command line - alexlz
  • and more you can? otherwise I didn’t quite understand what to do in the properties and how to start from the console? - MCneposeda

My advice - change the book. According to the standard, you need to write

 #include <iostream> int main() { std::cout << "Hello, word!" << std::endl; } 

And you have a very old book.

PS as a joke picture

    Try this:

     #include <iostream> using namespace std; int main() { cout << "Hello World!"; cin.get(); return 0; } 

      In general, everything was correct and for the first time, you just instantly turn off your console. you need to add the library #include <conio.h> And at the end, before retiring write _getch (); return 0;

      • one
        conio.h? Bury the stewardess! - VladD