Can't run program

Pages: 12
Hi,
I'm a beginner having problems with writing my hello world program.
I am using the tutorial on this site, because it seems easy to understand.
Allthough the coding I have made is the exact same as in the tutorial I can't run the program.

The error I get is:
Unable to start program 'C:\users\morten\documents\visual studio 2008\projects\test\debug\test.exe
The file does not exist

I am using Microsoft Visual C++ 2008 Express Edition.

Can anyone tell me what the error is?
Have you built test.exe in advance?
Nope, just got the program over night so trying to learn the codes.

Can you tell me how to?
Press F7 to compile your code and then ctrl+F5 or just F5 to run your program.
Still doesn't work..

Now it says:
The debugger does not support debugging managed and native code at the same time on this platform.
Which project template did you started with? On VC++ you should always start with an empty project
I started with the CLR Class Library..
I suggest you:
- create a new Empty Project
- copy/paste your code -or move the files- into the new project
- delete the old project
- compile the new project, it should work
Tryed it and it worked, just got a small problem that the program is shotting down imidiately after printing the text.

Have looked in the other topic but none of the solusions seem to work correctly, the program is still shotting down..
Here is the article: http://www.cplusplus.com/forum/articles/7312/
Are you using cin >> before the program end?
Nope, my code looks exactly like this:
http://www.cplusplus.com/doc/tutorial/program_structure/

I have tried some different solutions shown in the article you are linking to, but they don't seem to work..
This should work:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <limits> // for numeric_limits
using namespace std;

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

  cin.ignore ( numeric_limits<streamsize>::max(), '\n' ); // "The Standard Way" in the article
  return 0;
}
Yay it's working..
Thanks mate.. :)
I just ran into the same problem again during this tutorial:
http://www.cplusplus.com/doc/tutorial/basic_io/

The program is closing as soon as I press enter, is there a way that I can "delay" the closing of the program so I can se the program after pressing enter?
That's the cin >> problem, it leaves the \n character in the stream.
With cin you should use getline: http://www.cplusplus.com/forum/articles/6046/
so instead of cin >> i should type getline(cin, )?
To get a string, you use getline(cin, mystr); //mystr is a string
You can also use getline() to get an integer or character, but no directly, you must use an alternative method (http://www.cplusplus.com/forum/articles/6046/ shows you how to get all 3 types of input that can handle invalid input).
Yes, but only if you are using string objects from the string class <string>

Otherwise use cin.getline();
It doesn't seem to work..

The window is still closing after I press enter..

Instead of cin >> i have written cin.getline but it is telling me there are some error in the code..

I find that rather confusing?
What is your code with getline?
Pages: 12