News:

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

Main Menu

Anything wrong? but where and what is iostream used for running C++?

Started by rose1975, June 30, 2017, 02:20:01 AM

Previous topic - Next topic

rose1975

I am a c++ beginner, knowing little about how to setup platform for running c++...
So I install codeblocks (codeblocks-16.01-setup), and MinGW(mingw-get-setup, which is installed at C:\program files(86)\codeblocks\MinGW)
Then, I copied the following to a new file made when running codeblocks,

// This is my first program is C++
/* this program will illustrate different components of
a simple program in C++ */

#include <iostream>
using namespace std;

int main()
{
   cout << "Hello World!";
   return 0;
}


But, I can't get the results as shown as others online....
actually, it pops up
information: it seems that this file has not been built yet, do you want to build it now:
Yes/No/Cancel

and if you click No, it pop up dos screen: ask you press any key to return. Build Message says:
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
C:\C++\Untitled1.c|5|fatal error: iostream: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|


So, what shall I do next? any help is apreciated!



stahta01

Read this FAQ http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Quote from FAQ
QuoteRemember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file.


Edit: CB is designed to compile code inside of CB projects; if you do NOT want to use CB projects I suggest you think twice about why you do NOT wish to use CB projects.

Tim S.
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]