Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: kmiller10 on August 16, 2021, 08:14:11 am

Title: Just Started C++ Coding in Code Blocks and I Continuously Run Into This Error
Post 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; }
Title: Re: Just Started C++ Coding in Code Blocks and I Continuously Run Into This Error
Post by: oBFusCATed on August 16, 2021, 10:44:06 am
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.
Title: Re: Just Started C++ Coding in Code Blocks and I Continuously Run Into This Error
Post by: AndrewCot on August 16, 2021, 11:21:32 am
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.