MS Visual Studio问题?

时间:2015-02-06 16:25:50

标签: c++ visual-studio visual-studio-2013

我的教授希望我们在MS Visual Studio 2013中提交我们的项目。起初我没有意识到这一点,只是在桌面上的一个文件夹中创建了一个.cpp和.h文件,之后我运行了g ++ myFile.cpp ,/ a.out做我需要的一切。 但是...我尝试将这两个文件复制到一个MS Visual Studio 2013项目中,当我构建并运行它时,我看到一个终端打开和关闭非常快速 (我在控制台应用程序中)。对我来说没有意义的是我的程序有Cin并需要用户输入。为什么我没有看到任何一个couts而且没有接受任何输入?谢谢 编辑:这是我第一次使用visual studio

输出是这样的:

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

\'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Users\rvalent4\Desktop\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

The thread 0x9f0 has exited with code 259 (0x103).

The thread 0x1038 has exited with code 259 (0x103).

'ConsoleApplication1.vshost.exe' (CLR v4.0.30319: ConsoleApplication1.vshost.exe): Loaded 'C:\Users\rvalent4\Desktop\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe'. Symbols loaded.

The thread 0x114 has exited with code 259 (0x103).

The thread 0x14c4 has exited with code 259 (0x103).

The program '[1880] ConsoleApplication1.vshost.exe' has exited with code 0 (0x0).

1 个答案:

答案 0 :(得分:1)

如果应用程序是vanilla C ++应用程序(或以某种方式使用Win32 API的应用程序),则选择

File -> New -> Project...并确保您将Visual C++视为模板。

然后选择Win32 Console Application作为项目类型。

选择项目后,您可以编辑main.cpp文件,或从项目中删除main.cpp文件并添加教授给出的文件(假设您的源文件有main()函数已定义)。

项目应该构建好,禁止任何编译器和链接器错误。

下一步是正确运行程序。您可以启动调试器(F10 key),在main()函数末尾设置断点,然后(F5 key)继续运行。