New to Visual Studio - Can't see output
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQufYWs_LSL9nKmXjRctkFJcQePSJkOz9GPRoc6OtwO2WPOLYn045K5lGDmdOArE2SglhSmaUxIWTAjryhnM2dPF4eQiqfzZ8wUrZY02hSJP3ZLUmsvXXcb8JNJmmeRAabJniBNgLodueu/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5keIxetoWFTGiqNrhoImhVJ4jSy0bvRjEBU8SsuLp6HM2YbrY3VJQc0ZZArEV9XnfreTQqyk8QslMcjjPRF7HEwwHEMDC4a0-DnM_3bk2brtRBcOua0WnBgm6zbELPfnlDomLf16xhTQo/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
New to Visual Studio - Can't see output
I have to do a programming project for an optimisation class, that has to be written in C or C++. So I'm trying to figure out Visual Studio 2015. I created a blank project, and opened a new C++ file, where I have the following:
#include <iostream>
int main()
{
cout >> "Hello World!/n";
cin.get();
return 0;
}
When I run it, I get a large blank white popup, and nothing else happens, even if I hit various key on the keyboard or wait for several minutes. It looks like this:
If I close the large popup, nothing happens. What Visual Studio refers to as output from build looks like this:
1>------ Deploy started: Project: LinearProgramming, Configuration: Debug Win32 ------
1>Updating the layout...
1>Deployment complete (157ms). Full package name: "53acc796-5708-4314-9034-f2a1f840a4f4_1.0.0.0_x86__eazt3av84y7ym"
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
Could anyone please explain to me what's going on? How can I create a simple C++ project in Visual Studio 2015 and run it?
By the way, your microsoft account name is visible in your screenshot.
– melak47
Oct 17 '15 at 23:17
In addition to melak47's answer, you might want to check the direction of the
<<
in cout >> "Hello World!/n";
.– Bo Persson
Oct 17 '15 at 23:39
<<
cout >> "Hello World!/n";
I don't think anyone here understands the question. The code runs, but you can't see the simple "Hello World". It only gives the exit code for a successful completion.
– Aunt Jemima
22 mins ago
3 Answers
3
I believe you selected the "Blank App(Universal Windows)" project template, which is like a Microsoft store application. What you probably want is the "Win32 Console Application" template, which creates an application without its own window (and uses the console for I/O).
This is how I create a Win32 Console Application.
File->New->Project...
Visual C++->Win32->Win32 Console Application
Next >
Console application
Empty project
Solution Explorer
Source Files
Add->New Item...
C++ File (.cpp)
Add
>>
<<
The quick answer is to hit ctrl-f5 to open the console. After running your script and showing your output it waits for you to hit a key before closing the console.
I eventually found the answer to the question which can be seen at How to keep the console window open in Visual C++?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
This code shouldn't compile.
– n.m.
Oct 17 '15 at 23:15