在Visual Studio Express 2013中为初学者设置c++

C++ Setup for beginners in Visual Studio Express 2013

本文关键字:初学者 设置 c++ 2013 Visual Studio Express      更新时间:2023-10-16

我只是问一个乞丐程序员的一般问题:我如何设置/配置visual studio express 2013为乞丐?

我问,因为我在编译一个简单的'Hello World'程序时遇到了麻烦。

这是我的代码:

#include <iostream>
int main()
{
cout << "Hello World!" << endl;
return 0;
}

错误如下:

Error   1   error C2065: 'cout' : undeclared identifier c:usersblakedocumentsvisual studio 2013projectshello worldhello worldapp.xaml.cpp   6   1   Hello world
Error   2   error C2065: 'endl' : undeclared identifier c:usersblakedocumentsvisual studio 2013projectshello worldhello worldapp.xaml.cpp   6   1   Hello world
Warning 3   warning C4447: 'main' signature found without threading model. Consider using 'int main(Platform::Array<Platform::String^>^ args)'. c:usersblakedocumentsvisual studio 2013projectshello worldhello worldapp.xaml.cpp   8   1   Hello world
    4   IntelliSense: identifier "cout" is undefined    c:UsersBlakeDocumentsVisual Studio 2013ProjectsHello worldHello worldApp.xaml.cpp   6   2   Hello world
    5   IntelliSense: identifier "endl" is undefined    c:UsersBlakeDocumentsVisual Studio 2013ProjectsHello worldHello worldApp.xaml.cpp   6   28  Hello world

我已经关闭预编译头,但我仍然得到的问题。

我知道如果我把STD::放在前面,然后结束,我就可以避免两个错误。主要是因为我没有使用命名空间std. -我可以自己解决这个问题。

我还需要做什么吗?-我需要设置它纯粹为初学者,所以我可以编译和直接运行的东西!

在哪里运行编译后的文件?

  1. 文件->新建->项目。
  2. 在Visual c++项目类型窗格中,单击Win32,然后单击Win32控制台应用程序。
  3. 为项目键入一个名称,单击OK。
  4. 在Win32应用程序向导中,单击"下一步",选择"空项目",然后单击"完成"。

    来源和链接到完整的指南:http://msdn.microsoft.com/en-us/library/ms235629.aspx
    Visual Studio Express图片指南:http://cplusplus.com/doc/tutorial/introduction/visualstudio

    现在下面的代码应该可以工作了:
    #include <iostream>
    using namespace std;
    int main()
    {
        cout << "Hello World!" << endl;
        return 0;
    }
    

    当前,控制台窗口将在程序执行完成后立即退出。您可能希望在返回语句之前设置一个断点,以便查看程序的输出。

    尝试在"include"行后面添加一行,并写入

    using namespace std;