Neither <iostream>
nor <iostream.h>
are standard C header files. Your code is meant to be C++, where <iostream>
is a valid header. Use a C++ compiler such as clang++
or g++
(and a .cpp
file extension) for C++ code.
Alternatively, this program uses mostly constructs that are available in C anyway. It’s easy enough to convert the entire program to compile using a C compiler. Simply remove #include <iostream>
and using namespace std;
, and replace cout << endl;
with putchar('\n');
… I advise compiling using C99, C11 or C18 (eg. gcc -std=c99
, clang -std=c18
etc)
Related Posts:
- gcc/g++: “No such file or directory”
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- What is the difference between g++ and gcc?
- Convert char to int in C and C++
- Undefined reference to vtable
- Undefined reference to vtable
- Eclipse C++ : “Program “g++” not found in PATH”
- Compiling a C++ program with gcc
- error: use of deleted function
- Debug vs Release in CMake
- Debug vs Release in CMake
- gcc: undefined reference to
- Update GCC on OSX
- gcc -g :what will happen
- cc1.exe System Error – libwinpthread-1.dll missing – But it isn’t
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- What is a segmentation fault?
- What is the difference between float and double?
- Why are #ifndef and #define used in C++ header files?
- g++ ld: symbol(s) not found for architecture x86_64
- Floating point exception( core dump
- Mutex example / tutorial? [closed]
- What does “dereferencing” a pointer mean?
- What is an unsigned char?
- C++ undefined reference to defined function
- How to track down a “double free or corruption” error
- How does #include
work in C++? - How to go from fopen to fopen_s
- Difference between long double and double in C and C++ [duplicate]
- What is use of c_str function In c++
- What is the difference between const int*, const int * const, and int const *?
- What is the C version of RMI
- How to print pthread_t
- make: g++: Command not found
- What is the difference between const int*, const int * const, and int const *?
- C ++ error: a expected initializer before [function name]
- Compiling C++11 with g++
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Difference between using Makefile and CMake to compile the code
- What is the difference between a static and const variable?
- Should I learn C before learning C++?
- Visual Studio debugger error: Unable to start program Specified file cannot be found
- unsigned int vs. size_t
- error: expected primary-expression before ‘)’ token (C)
- Examples of good gotos in C or C++
- What is activation record in the context of C and C++?
- “g++” is not recognized as an internal or external command, MinGW
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Undefined reference to class constructor, including .cpp file fixes
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- Fatal error: ‘stdafx.h’ file not found
- What does ‘const static’ mean in C and C++?
- How to use glOrtho() in OpenGL?
- Best C/C++ Network Library
- Is the sizeof(some pointer) always equal to four?
- 2D array vs array of arrays
- How do malloc() and free() work?
- CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
- How to run valgrind with basic c example?
- expected unqualified-id before string constant
- Typedef function pointer?
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- cannot declare variable ‘’ to be of abstract type ‘’
- What is the use of intptr_t?
- C++ Error ‘nullptr was not declared in this scope’ in Eclipse IDE
- How can I get the list of files in a directory using C or C++?
- How can I get the list of files in a directory using C or C++?
- What are the different versions of exec used for in C and C++?
- What’s the difference between nexti and stepi in gdb?
- C++ – Too Many Initializers for Arrays
- Reading string by char till end of line C/C++
- Is there a replacement for unistd.h for Windows (Visual C)?
- C++ – include unistd.h: why not cunistd?
- Error: free(): invalid next size (fast):
- How to project a point onto a plane in 3D?
- Error: free(): invalid next size (fast):
- Why use pointers?
- I get this error: “glibc detected”
- What’s the difference between * and & in C?
- G++ undefined reference to class::function
- Undefined reference to class constructor, including .cpp file fixes
- Difference between pic Vs pie
- Double pointer array in c++
- GCC -fPIC option
- What’s the meaning of exception code “EXC_I386_GPFLT”?
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- What is the job of autogen.sh when building a c++ package on Linux
- What’s the Use of ‘\r’ escape sequence?
- Difference between
and - Is there a standard sign function (signum, sgn) in C/C++?
- Using OpenMP with clang
- Warning: comparison of distinct pointer types
- Two decimal places using printf( )
- What does “-Wall” in “g++ -Wall test.cpp -o test” do?
- Make / gcc cryptic error 2: how to have more information?
- Difference between the int * i and int** i
- Is there a way to compile C++ to C Code?
- What is a .h.gch file?
- Update g++ but still old version
- Whats the difference between UInt8 and uint8_t