一、去掉预编译头

使用VS2017的时候,发现总是会有“pch.h”,“stdafx.h”这类预编译头,去掉还会报错。作为新手的我,暂时用不到这些预编译头,于是想去掉它们。

右键项目->属性->C/C++->预编译头,如下图所示,然后选择不使用预编译头即可。

二、设置C++标准

用VS2017写C++的时候想设置一下C++标准,设置成C++14或C++17。

右键项目->属性->C/C++->语言,如下图所示,在C++语言标准选择想要的C++版本即可。

三、使用<bits/stdc++.h>头文件

因为直前用别的编译器都习惯用#include<bits/stdc++.h>都懒得打头文件了。然后,发现VS2017使用这个头文件会报错提示找不到,于是上网找了一下办法。

既然VS2017没有,我们就自己加上去,找到VS2017安装目录,然后找到include文件,我的文件路径是这个:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include

然后自己创一个bits文件夹,然后进入bits文件夹,创建stdc++.h文件,添加下面的内容:

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime> #if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif // C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector> #if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

添加完成之后,我们就能正常地使用#include<bits/stdc++.h>了。

使用VS2017遇到的一些小问题的更多相关文章

  1. 【VS工具】vs2017中的一些小功能

    一.json转为类 1.打开一个json文件,复制 2.打开一个.cs文件,将json粘贴为类 3.got it 二.C#交互窗口 1.视图->其他窗口->C#交互窗口  2.打开了一个窗 ...

  2. VS2017 - Winform 简单托盘小程序

    界面比较简单,主要两个button 一个NotifyIcon 和 右键菜单 控件, NotifyIcon 属性,如下: 并为NotifyIcon指定了DoubleClick事件: 主窗体增加两个事件: ...

  3. Asp.NetCore1.1版本没了project.json,这样来生成跨平台包

    本章将要和大家分享的是Asp.NetCore1.1版本去掉了project.json后如何打包生成跨平台包, 为了更好跟进AspNetCore的发展,把之前用来做netcore开发的vs2015卸载后 ...

  4. Visual studio 编辑combobox程序卡死的问题

    问题描述:使用vs2017开发一个winform小程序,一用combobox就卡死. 问题解决:关闭有道词典的取词功能. 软件开多了,就容易有冲突啊!

  5. 【asp.net core】Publish to a Linux-Ubuntu 14.04 Server Production Environment

    Submary 又升级了,目录结构有变化了 . project.json and Visual Studio 2015 with .NET Core On March 7, 2017, the .NE ...

  6. Vs2017 typescript 开发小问题

    最近想写点ts的东西,以前用vs2015很方便,直接创建一个ts app项目就折腾了. Vs2017打开,居然发现这个项目模板不见了.   于是研究了一下,由于原来的ts app项目就是一个asp.n ...

  7. windows10 vs2017编译opencv_contrib3.4.7的小坑及编译好的资源

    1.注意要用正斜杠  /    不要用 \  https://github.com/opencv/opencv/issues/11655 CMake Error at cmake/OpenCVModu ...

  8. vs2017 .net core WebApp 去掉ApplicationInsights

    vs2017新建的 .net core WebApp都内置了这个遥测中间件进去,嗯,用AZURE的话是不错能无缝支持.但不用AZURE就没什么用了. 为了不占地方和提高一点点初始启动的速度,对新建的项 ...

  9. [干货来袭]C#7.0新特性(VS2017可用)

    前言 微软昨天发布了新的VS 2017 ..随之而来的还有很多很多东西... .NET新版本 ASP.NET新版本...等等..太多..实在没消化.. 分享一下其实2016年12月就已经公布了的C#7 ...

随机推荐

  1. 基于Jquery的下拉列表控件(个人觉得实用)

    Selectize.js Selectize 是一个基于 jQuery 的 <select> UI 控件,对于标签选择和下拉列表功能非常有用. Selectize 的目标是通过简单而强大的 ...

  2. mysql 使用 MD5函数 校验账号密码

    项目中账号密码需要加密操作,数据库用户表账号是明文,密码是密文,但是前端传递过来的都是密文,所以需要到数据库中加密账号和前端传递过来的密文做校验. 这时候就可以使用md5函数. 使用案例: SELEC ...

  3. 整合Spring+Hibernate+Struts2的时候发现json数据一直无法传到页面,提示no-Session

    执行了ajax,页面没有任何反应 怀疑json没有值,想查看json中的内容,使用了ObjectMapper: ObjectMapper om=new ObjectMapper(); System.o ...

  4. asp.net中的参数传递:Context.Handler 的用法

    网上天天有人问怎么在webform页面之间传值,基本上来说,大家熟悉的是     (1)url字符串传值     (2)session传值     (3)直接读取server.transfer过来的页 ...

  5. SRVCC B1,B2事件总结

    何为SRVCC? SRVCC(Single Radio Voice Call Continuity)是3GPP提出的一种VoLTE语音业务连续性方案,主要是为了解决当单射频UE 在LTE网络和2G/3 ...

  6. C#中的事件的订阅与发布

    认识发布者/订阅者模式 发布者定义一系列事件,并提供一个注册方法: 订阅者向发布者注册自己的事件处理逻辑,供一个可被回调的方法,也就是事件处理程序:当发布者的事件被触发的时候,订阅者将通过回调函数得到 ...

  7. ovirt常用后台维护命令

    以下命令是在node主机上操作 查看hosted-engine虚机的状态 hosted-engine --vm-status 启动hosted-engine虚机 hosted-engine --vm- ...

  8. List的复制 (浅拷贝与深拷贝)

    开门见山的说,List的复制其实是很常见的,List其本质就是数组,而其存储的形式是地址 如图所示,将List A列表复制时,其实相当于A的内容复制给了B,java中相同内容的数组指向同一地址,即进行 ...

  9. 20、Python常用模块sys、random、hashlib、logging

    一.sys运行时环境模块 sys模块负责程序与python解释器的交互,提供了一系列的函数和变量,用于操控python的运行时环境. 用法: sys.argv:命令行参数List,第一个元素是程序本身 ...

  10. js原型结构图

    要素:对象原型.函数原型: [p]  原型对象: p    模版对象: 要构造的对象的信息: 构造函数具有原型对象和模版对象: 普通对象只具有模版对象: https://zhuanlan.zhihu. ...