I'm new to this topic, so i started with basic program of printing 10 numbers.
The function has been defined in C++ and declared in my customized header file, now i want to access this function in C file. I have created the files, but i'm facing fatal error: iostream: No such file or directory
Please let me know where i'm going wrong. I have attached the programs below:
C++ code:
#include <iostream>
#include "my_header.h"
// Function definition
void printNumbers() {
for (int i = 1; i <= 10; i++) {
std::cout << i << " ";
}
std::cout << std::endl;
int main()
{
return 0;
}
}
Header file:
#include "my_cpp.cpp"
#ifndef NUMBERS_H
#define NUMBERS_H
// Function declaration
void printNumbers();
#endif
C code:
#include <stdio.h>
#include "my_header.h"
int main() {
// Call the function defined in C++
printNumbers();
return 0;
}
Thanks in advance.