Author Topic: Anything wrong? but where and what is iostream used for running C++?  (Read 6013 times)

Offline rose1975

  • Single posting newcomer
  • *
  • Posts: 3
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!



Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Anything wrong? but where and what is iostream used for running C++?
« Reply #1 on: June 30, 2017, 02:48:19 am »
Read this FAQ http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Quote from FAQ
Quote
Remember 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.
« Last Edit: June 30, 2017, 02:50:41 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org