Author Topic: Just Started C++ Coding in Code Blocks and I Continuously Run Into This Error  (Read 4977 times)

kmiller10

  • Guest
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; }

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
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.