• Register
2 votes
65 views

Problem:

I started learning C++ programming recently and trying to write my very first program in C++.

Here is my sample code

#include <iostream>
#include <Stdio.h>

using namespace std;

int main(){
   cout << "I am a C++ program" << endl;
   return 0;
}

As I learned, the program should display the output as:

I am a C++ program

But in my case, the program is displaying something like this instead of as I expected.

main.cpp:2:10: fatal error: Stdio.h: No such file or directory
 #include <Stdio.h>
          ^~~~~~~~~
compilation terminated.

What is the reason behind it? I am looking for a solution for the last thirty minutes and failed to gather the information about it. Could you, please save my day? I must recognize your kind help.

Thanks, guys.

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

2 votes

Solution:

Well, you have encountered a fatal error while importing the built-in libraries from the C++ library. Hence you have written 

#include <Stdio.h>

instead of 

#include <stdio.h>

The correct one is <stdio.h> not the capital S” one. The compiler tried to search from the library to find the header file and failed. Because there is no such header file available in the C++ library. Keep a sharp eye when you are importing them and keep correct the spelling. So, run the program as:

#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
   cout << "I am a C++ program" << endl;
   return 0;
}

and your program should run fine without an error. However, the <stdio.h> header file is not needed in this program.

Good Day!

13 9 6
94,260 points

Related questions

0 votes
1 answer 14 views
14 views
Problem: Did anybody have any clue: C++ no such file or directory
asked Mar 15 Wafa Abu Yousef 6.1k points
0 votes
1 answer 208 views
208 views
Problem : I am facing following MinGW issue: 'gcc' is not recognized as an internal or external command, operable program or batch file.
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
1 answer 2 views
2 views
Problem: When I try to compile my codes I got the error: mysql.h there is no such file. I looked in the folders, there is mysql.h file, I can't understand why I can't find it. Please assist me.
asked 4 days ago anika11 10.1k points
0 votes
1 answer 5 views
5 views
Problem: I really don't know why I am facing this error: iostream h no such file or directory .
asked Mar 19 Wafa Abu Yousef 6.1k points
0 votes
1 answer 9 views
9 views
Problem: HOW to solve this, any help: iostream h no such file or directory
asked Mar 17 Wafa Abu Yousef 6.1k points
0 votes
2 answers 14 views
14 views
Problem: I am facing this error while practicing some c++ related input-output statements. I really don't know why I am facing this error as according to me this suppose to be the syntax of the header file.
asked Oct 12, 2020 anonymous
0 votes
1 answer 23 views
23 views
Problem: Can someone please help to solve this Warning: format not a string literal and no format arguments
asked Mar 20 Ifra 25.7k points
1 vote
1 answer 1.2K views
1.2K views
Problem : I want to run the newly compiled binary on some of the very oldish 32bits RedHat distribution. This binary is compiled C (not C++) on the CentOS 32bits VM running the libc v2.12. RedHat complains about the libc version as below: Error while loading shared ... , that's why it is most likely not using anything new from the libc. Is there any way to reduce the libc version requirement?
asked Jan 2, 2020 alecxe 7.5k points
0 votes
0 answers 2 views
2 views
Problem: Can anyone know it's answer? If yes, then please answer me. Thanks in advance.
asked 2 days ago niyatiry 3.6k points
1 vote
1 answer 2 views
2 views
Problem: Need guidance with the compilation of C++ code from with in notepad++. Compile c++ in notepad++.
asked Mar 25 PkGuy 14k points