As a complete beginner I have been trying to "get into" C programming. While following a tutorial the following code failed to compile. Compiler reported it did not find iostream(.h) I have tried a number of IDEs and MinGW and Borland BCC55 compilers - same result.
1 2 3 4 5 6 7 8 9 10
#include <iostream.h>
usingnamespace std;
int main () {
cout << "Hello world";
return 0;
}
> As a complete beginner I have been trying to "get into" C programming.
Your first program is a C++ program.
Be clear on what language you want to learn.
Their common heritage and superficial similarity means if you try "C/C++", you end up making a mess of both.
It is my understand that "iostream.h" was the early header file when C++ first started. I believe the 1998 standards made changes that dropped the ".h" from the header files.
These days the newer compilers may not have some of the old C header files or the old C++ header files ending in ".h" as they have phased out.
This does not mean that C header files can not be used in a C++ program. Some C header files have a C++ version like "cstdlib" or "ctime" If they are available you should uses these over the old C header files. For a list check out the reference section with the link in the upper left corner. I also find this to be a good reference link https://en.cppreference.com/w/
As far as reading a tutorial you can try https://www.learncpp.com/ I have found this to very good and it is kept up to date.
following a tutorial...compiler cannot find iostream
That tutorial is seriously ancient. Including <iostream.h> is at least 20 (or so) years out of date, so most compilers created since 1998 will use <iostream> instead.
No tutorial will cover the entire C++ language. The most any can do is give a beginner a grasp of the language basics. Especially as newer standards become approved. The current standard is C++20.
I did post here again, but it seems to have disappeared. I would like to say thanks - the problem was I was using sections of code interchangeably - problem solved. Thanks again