You are here:

C++/can we write C++ in visual studio

Advertisement


Question
QUESTION: dear sir,

I am having Microsoft visual studio 2010 express(Microsoft visual c++ 2010 express).when i tried to run simple c++ programs in it,i got errors.i got error in all header files too.
eg iostream.h not defined
please tell whether i can run C++ programs in visual studio or not....

regards,
mayuri

ANSWER: > please tell whether i can run C++ programs in visual studio or not....

Yes, you can compile and build and run C++ programs using Microsoft Visual Studio 2010.


> i got error in all header files too.
> eg iostream.h not defined

iostream.h is not a C++ header file.

For a list of standard C++ headers, see http://cplusplus.com/reference/

Try this program:

#include <iostream>
using namespace std ;

int main()
{
       cout << "hello world!\n" ;
}

or, alternately:

#include <iostream>

int main()
{
       std::cout << "hello world!\n" ;
}




---------- FOLLOW-UP ----------

QUESTION: sir,
i tried to run dis program...
it cud compile but wen i tried to execute i got dis error...67 is d file name for my program..pls resolve dis error


'67.exe': Loaded 'C:\Documents and Settings\reshmirose\Desktop\67\Debug\67.exe', Symbols loaded.
'67.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'67.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'67.exe': Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Symbols loaded.
'67.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.
The program '[2896] 67.exe: Native' has exited with code 0 (0x0).

Answer
> '67.exe': Loaded 'C:\Documents and Settings\reshmirose\Desktop\67\Debug\67.exe', Symbols loaded.
> '67.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
> '67.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
> '67.exe': Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Symbols loaded.
> '67.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.

These are not errors, merely informational messages which you can safely ignore for now.



> The program '[2896] 67.exe: Native' has exited with code 0 (0x0).

The program has executed and exited without errors ( code 0 ).



If you want the program to wait after "hello world!\n" is printed, add this just below it; it will wait till you press the enter key:

   std::cout << "press the enter key to quit: " ;
   std::cin.get() ;

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.