User forums > General (but related to Code::Blocks)

Just Started C++ Coding in Code Blocks and I Continuously Run Into This Error

(1/1)

kmiller10:
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; }

oBFusCATed:
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.

AndrewCot:
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.

Navigation

[0] Message Index

Go to full version