【发布时间】:2014-03-27 22:08:31
【问题描述】:
我只是向初学者程序员提出一个通用问题:如何为初学者设置/配置 Visual Studio Express 2013?
我在编译一个简单的“Hello World”程序时遇到问题。
这是我的代码:
#include <iostream>
int main()
{
cout << "Hello World!" << endl;
return 0;
}
这些是错误:
Error 1 error C2065: 'cout' : undeclared identifier c:\users\blake\documents\visual studio 2013\projects\hello world\hello world\app.xaml.cpp 6 1 Hello world
Error 2 error C2065: 'endl' : undeclared identifier c:\users\blake\documents\visual studio 2013\projects\hello world\hello world\app.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:\users\blake\documents\visual studio 2013\projects\hello world\hello world\app.xaml.cpp 8 1 Hello world
4 IntelliSense: identifier "cout" is undefined c:\Users\Blake\Documents\Visual Studio 2013\Projects\Hello world\Hello world\App.xaml.cpp 6 2 Hello world
5 IntelliSense: identifier "endl" is undefined c:\Users\Blake\Documents\Visual Studio 2013\Projects\Hello world\Hello world\App.xaml.cpp 6 28 Hello world
我已关闭预编译头文件,但我仍然遇到问题。
我知道如果我把 STD:: 放在 cout 和 endl 的前面,我就可以摆脱其中的两个错误。主要是因为我没有使用命名空间std。 - 我可以自己解决这个问题。
还有什么我需要做的吗? - 我需要纯粹为初学者设置它,这样我就可以编译并立即运行!
在哪里运行编译后的文件?
【问题讨论】:
-
您使用的是 c++/cli?还是某种托管的c++?警告 3 中 main 函数的签名以及警告 3-5 中对 app.xaml 的引用看起来不像普通的 c++。
标签: c++ visual-studio installation