User forums > Using Code::Blocks

Why doesn't C::B recognize #include <iostream>

(1/1)

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

--- End code ---

stahta01:
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

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

papagym:
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++

BlueHazzard:

--- Quote from: 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++

--- End quote ---
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....

Navigation

[0] Message Index

Go to full version