There must be a very simple book for beginners but could not locate it.
I try :
Code:Code:#include "iostream.h" int main() { cout << "Hello\n"; }
and get errors about header file. I am using Ubuntu 17.04 and gcc is 6.3.0
TIA
Regards
There must be a very simple book for beginners but could not locate it.
I try :
Code:Code:#include "iostream.h" int main() { cout << "Hello\n"; }
and get errors about header file. I am using Ubuntu 17.04 and gcc is 6.3.0
TIA
Regards
ReplacewithCode:#include "iostream.h". Then putCode:#include <iostream>at the top of main(). This should probably be in the C++ board, though.Code:using namespace std;
Thank you, but is says: iostream: no such file or directory
Are you trying to learn C or C++? If you are trying to learn C, then you are reading the wrong material. If you are trying to learn C++, then you are reading poorly written material and posting in the wrong place, and probably using the wrong compiler (i.e., you should use g++ instead of plain gcc, which by default does not link to C++ libraries, hence your problem).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Ok I'm trying to learn C not C++, and reading tutorial in this website which should be correct I assume.
Ok when I used g++ it all worked well, thanks
So does that mean even if I write C code, I should always compile with g++ ?
Last edited by Kemal; 06-14-2017 at 02:55 AM.
There are separate C and C++ tutorials.
C C Tutorial - Learn C - Cprogramming.com
C++ C++ Tutorial - Learn C++ - Cprogramming.com
It helps if you can aim a mouse I guess.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Thank you Salem, regards