Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: kmiller10 on August 16, 2021, 08:14:11 am
-
Whenever I would try to run my code I would run into an error that would say "fatal error: iostream: No such file or directory." What can I do to fix this issue. My code works well on internet compilers but doesn't seem to work inside of Code Blocks. Is there any way to fix this error?
include<iostream>
using namespace std;
int main() { cout<<"Hello World"; return 0; }
-
Without seeing the build log I would guess that you're using .c instead of .cpp as your file extension. If this is not it please post the full build log.
-
You need a # in front of the include as follows and IMHO you need to check out how to format a program as it is NOT formatted very well as you are missing spaces (between #include and "<") and the main line should not be one line.
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}
You also need to read up on C++ programming as C:B is an IDE. It is not a compiler.