-3

I get this error although I named the file .c++ and cant find solution .also tried using <iostream.h> and did not work. please help.1

adding .c++ to file name. also tried using <iostream.h> and did not work.

Malik Mh
  • 1
  • 1
  • [Why should i not upload images of code/data/errors?](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors) – 463035818_is_not_an_ai Aug 29 '23 at 15:49
  • 1
    I'd argue that your C++ compiler installation is faulty. – Some programmer dude Aug 29 '23 at 15:51
  • "compiler: unknown" ? That looks fishy. Do you have a compiler installed? – 463035818_is_not_an_ai Aug 29 '23 at 15:51
  • that is codeblocks ide – Malik Mh Aug 29 '23 at 15:53
  • *also tried using * -- As to your program, the proper header is ``, however you are using `printf`, where the proper header is actually ``. – PaulMcKenzie Aug 29 '23 at 15:53
  • 2
    codeblocks is an IDE, it is not a compiler. Maybe it comes with a compiler included, I dont know, but you do need to have a c++ compiler installed to compile the code – 463035818_is_not_an_ai Aug 29 '23 at 15:53
  • i added the wrong image with the printf. – Malik Mh Aug 29 '23 at 15:54
  • @MalikMh -- Are you aware that codeblocks is not the compiler? What compiler are you using? Is it `g++`? `clang`? – PaulMcKenzie Aug 29 '23 at 15:56
  • 1
    IDEs are supposed to make it simple to set up a working environment, ironically that makes it difficult for beginners to understand the basics. For a simple one file program I suggest you to invoke the compiler from the command line. If that doesnt work, the IDE is of no help either. And once you made sure the compiler is fine, you can still use whatever IDE – 463035818_is_not_an_ai Aug 29 '23 at 15:57
  • i dont know dude i always use codeblocks when coding using C language but it does not work for cpp. – Malik Mh Aug 29 '23 at 15:57
  • @MalikMh -- *i dont know* -- You should know the tools that you are using to build a program. The compiler in all likelihood is `g++`. Go to the command-line and enter `g++`. If that program cannot be found, then you did not install the compiler. – PaulMcKenzie Aug 29 '23 at 16:00
  • @PaulMcKenzie it is a GNU GCC compiler – Malik Mh Aug 29 '23 at 16:02
  • Name the file `file.cpp`, not `file.c++`. Second, go to the command line, go to the directory where `file.cpp` is located, and enter `g++ file.cpp`. Are there any errors? If not, there should be an `a.out` file (assuming this is Linux). If there are errors, then address those errors. This is the least you have to know before using fancy IDE's, which hides all of these basic (beginner) steps from you. – PaulMcKenzie Aug 29 '23 at 16:06
  • i cant find how to open the command line in this thing. IDK i might use a different thing – Malik Mh Aug 29 '23 at 16:16
  • 1
    ***i cant find how to open the command line in this thing.*** You probably should spend some time to learn about your OS and how the command line works: [https://www.freecodecamp.org/news/command-line-commands-cli-tutorial/](https://www.freecodecamp.org/news/command-line-commands-cli-tutorial/) – drescherjm Aug 29 '23 at 16:19
  • To get codeblocks working you probably want to install [msys2](https://www.msys2.org/#installation) then use these [instructions](https://stackoverflow.com/questions/66453827/how-to-configure-msys2-in-codeblocks) to setup Code::Blocks to use the MinGW that msys2 installs. – drescherjm Aug 29 '23 at 16:24
  • Somewhere Code::Blocks will let you see the full build output. Make sure g++ is being invoked, not gcc. – user4581301 Aug 29 '23 at 16:54

0 Answers0