Visual C ++给我400多个错误? [英] Visual C++ gives me 400 plus errors?

查看:58
本文介绍了Visual C ++给我400多个错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级了操作系统(Windows 10)并安装了Visual Studio2015.我试图编译一个简单的程序并遇到400多个错误,我检查了库并按要求进行设置,但仍不确定在哪里我的问题是.有人可以帮忙吗?

I just upgraded my operating system(Windows 10) and installed Visual Studio 2015. I am trying to compile a simple program and getting 400+ errors, I checked for the libraries and I set them as required, but still not sure where my problem is.. Could anyone please help?

推荐答案

  1. 如果要使用命名空间std,请执行以下操作:没有理由使用std ::开头的代码:您可以将其从代码中删除,也可以删除名称空间,否则它是多余且毫无意义的,而您只是为自己做更多的工作.

  1. If You're going to use namespace std; There is no reason to preface things with std:: you can remove that from your code or remove the namespace otherwise it's redundant and pointless and you're just making more work for yourself.

使用cin.get();由于开发人员提示不会自动关闭,并且您需要按提示中的某个键才能真正将其关闭,因此此处不需要.基本上是什么cin.get();也做得很好,所以这是多余的.

The use of cin.get(); is not required here as the developer prompt does not close automatically and requires you to press a key inside the prompt to actually close it. Which is basically what cin.get(); is doing as well so this is more redundancy.

最后要回答您的问题,您正在使用Visual Studio,这意味着您需要执行以下一项操作.

And finally to answer your question you're using visual studio which means you need to do 1 of the following.

  1. 在创建项目时,如果仅单击下一步并关闭预编译的标头,则会弹出一个带有下一步"和完成"选项的小框,您的当前代码将起作用.

  1. When you create your project a little box pops up with the Next and Finish option if you simply click next and turn off pre compiled headers your current code will work.

除非关闭预编译的标头,否则必须使用以下标头,并且必须将其放在所有其他标头文件之前

Unless you turn off pre-compiled headers you must use the following header and you must place it before all other header files

#include "stdafx.h"

当您设置基本的Visual Studio项目时,它将看起来像这样.您可以更改main,但必须包含microsoft标头,除非您关闭预编译的标头.

When you setup a basic visual studio project it will look like this, You can change main but you must include the microsoft header unless you turn off pre-compiled headers.

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
   return 0;
}

选择这些选项之一,您的代码将可用:)

Choose one of those options and your code will work :)

这篇关于Visual C ++给我400多个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆