Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: papagym on October 23, 2015, 02:22:09 am

Title: Why doesn't C::B recognize #include <iostream>
Post by: papagym on October 23, 2015, 02:22:09 am
I'm getting a red box next to #include <iostream> and a compiler error when I try to compile this simple C++ code, why?

Code
#include <iostream>

int main ()
{
 int i = 10;
float f = i;
std::cout << f;

return 0;
}
Title: Re: Why doesn't C::B recognize #include <iostream>
Post by: stahta01 on October 23, 2015, 04:31:40 am
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Title: Re: Why doesn't C::B recognize #include <iostream>
Post by: Jenna on October 23, 2015, 09:43:07 am
Most of the times this happens because the file has no valid ending for a c++-file and will therefore be treated as c-file or anything else.
Title: Re: Why doesn't C::B recognize #include <iostream>
Post by: papagym on November 18, 2015, 08:39:01 pm
Sorry for the delayed reply I think the code was saved as a c file.
I believe this is a fault of the way Microsoft save a file.
It would be nice if we could get Microsoft to change the default saved file type from C to C++
Title: Re: Why doesn't C::B recognize #include <iostream>
Post by: BlueHazzard on November 21, 2015, 02:50:51 pm
Sorry for the delayed reply I think the code was saved as a c file.
I believe this is a fault of the way Microsoft save a file.
It would be nice if we could get Microsoft to change the default saved file type from C to C++
This has nothing to do with microsoft, but how YOU safe the file.
If you create a new project you can select c or c++ and c::b will safe the file accordingly with c or cpp extension....