I am new to c++. I just started! I tried a code on visual c++ 2010 Express version but i got the following code error message.
------ Build started: Project: abc, Configuration: Debug Win32 ------ ugo.cpp c:\users\castle\documents\visual studio 2010\projects\abc\abc\ugo.cpp(3): fatal error C1083: Cannot open include file: 'iostream': No such file or directory ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This is the code
// first.cpp -- displays a message #include <iostream> // a PREPROCESSOR directive int main(void) // function header { // start of a function body using namespace std; cout << "Come up and C++ me sometime.\n"; // message // start a new line cout << "Here is the total: 1000.00\n"; cout << "Here we go!\n"; return 0; }
So, #include is a preprocessor directive that tells the preprocessor to include header files in the program. < > indicate the start and end of the file name to be included. iostream is a header file that contains functions for input/output operations ( cin and cout ).
you have missing iostream. h file in you mingw directory folder placed inside codeblocks/devc++. what you have to do is just download the file from link given below and replace with your previous mingw folder in codeblocks/devc++.
C++ input/output streams are primarily defined by iostream , a header file that is part of the C++ standard library (the name stands for Input/Output Stream). In C++ and its predecessor, the C programming language, there is no special syntax for streaming data input or output.
Replace
#include <iostream.h>
with
using namespace std; #include <iostream>
Some things that you should check:
Check the include folder in your version of VS (in "C:\Program Files\Microsoft Visual Studio xx.x\VC\include
" check for the file which you are including, iostream
, make sure it's there).
Check your projects Include Directories in <Project Name> > Properties > Configuration Properties > VC++ Directories > Include Directories
- (it should look like this: $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
)
Make sure that you selected the correct project for this code (File > New > Project > Visual C++ > Win32 Console Application
)
Make sure that you don't have <iostream.h>
anywhere in your code files, VS doesn't support that (in the same project, check your other code files, .cpp and .h files for <iostream.h>
and remove it).
Make sure that you don't have more than one main()
function in your project code files (in the same project, check your other code files, .cpp and .h files for the main()
function and remove it or replace it with another name).
Some things you could try building with:
using namespace std;
from your main()
function and put it after the include directive.std::cout
without using namespace std;
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With