News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

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

Started by papagym, October 23, 2015, 02:22:09 AM

Previous topic - Next topic

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?


#include <iostream>

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

return 0;
}

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

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++
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....