使用VS2017遇到的一些小问题
一、去掉预编译头
使用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遇到的一些小问题的更多相关文章
- 【VS工具】vs2017中的一些小功能
一.json转为类 1.打开一个json文件,复制 2.打开一个.cs文件,将json粘贴为类 3.got it 二.C#交互窗口 1.视图->其他窗口->C#交互窗口 2.打开了一个窗 ...
- VS2017 - Winform 简单托盘小程序
界面比较简单,主要两个button 一个NotifyIcon 和 右键菜单 控件, NotifyIcon 属性,如下: 并为NotifyIcon指定了DoubleClick事件: 主窗体增加两个事件: ...
- Asp.NetCore1.1版本没了project.json,这样来生成跨平台包
本章将要和大家分享的是Asp.NetCore1.1版本去掉了project.json后如何打包生成跨平台包, 为了更好跟进AspNetCore的发展,把之前用来做netcore开发的vs2015卸载后 ...
- Visual studio 编辑combobox程序卡死的问题
问题描述:使用vs2017开发一个winform小程序,一用combobox就卡死. 问题解决:关闭有道词典的取词功能. 软件开多了,就容易有冲突啊!
- 【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 ...
- Vs2017 typescript 开发小问题
最近想写点ts的东西,以前用vs2015很方便,直接创建一个ts app项目就折腾了. Vs2017打开,居然发现这个项目模板不见了. 于是研究了一下,由于原来的ts app项目就是一个asp.n ...
- windows10 vs2017编译opencv_contrib3.4.7的小坑及编译好的资源
1.注意要用正斜杠 / 不要用 \ https://github.com/opencv/opencv/issues/11655 CMake Error at cmake/OpenCVModu ...
- vs2017 .net core WebApp 去掉ApplicationInsights
vs2017新建的 .net core WebApp都内置了这个遥测中间件进去,嗯,用AZURE的话是不错能无缝支持.但不用AZURE就没什么用了. 为了不占地方和提高一点点初始启动的速度,对新建的项 ...
- [干货来袭]C#7.0新特性(VS2017可用)
前言 微软昨天发布了新的VS 2017 ..随之而来的还有很多很多东西... .NET新版本 ASP.NET新版本...等等..太多..实在没消化.. 分享一下其实2016年12月就已经公布了的C#7 ...
随机推荐
- Linux学习笔记之Linux磁盘及文件系统管理笔记
Linux磁盘及文件系统管理 CPU,memory(RAM),I/O i/o: disks,ehtercard disks:持久存储数据 接口类型: IDE(ata): 并口,133MB/s;并行总线 ...
- 设置$.post,$.get,$.ajax 全局同异步
$.ajaxSetup({ async: false//or true });
- WebApi自定义全局异常过滤器及返回数据格式化
WebApi在这里就不多说了,一种轻量级的服务,应用非常广泛.我这这里主要记录下有关 WebApi的相关知识,以便日后使用. 当WebApi应用程序出现异常时,我们都会使用到异常过滤器进行日志记录,并 ...
- Pika 连接 rabbitmq 集群
原文:https://blog.csdn.net/Tech_Salon/article/details/82890431 使用 Pika 连接 rabbitmq 集群使用 python 编程经常会用到 ...
- element-UI级联选择器(Cascader)获取label值 ,this.$refs['新组件名'].currentLabels 在2.7版本给移除了,新的解决方法。
原文参考:https://blog.csdn.net/lijiabinbbg/article/details/97396812 遇到的新的问题是如果设置了ref,那么v-model绑定的值不会动态更新 ...
- Java自学-数字与字符串 字符串
Java中的字符串String 示例 1 : 创建字符串 字符串即字符的组合,在Java中,字符串是一个类,所以我们见到的字符串都是对象 常见创建字符串手段: 每当有一个字面值出现的时候,虚拟机就会创 ...
- mybatis关联映射一对一
在项目开发中,会存在一对一的关系,比如一个人只有一个身份证,一个身份证只能给一个人使用,这就是一对一关系.一对一关系使用主外键关联. table.sql,在数据库中创建如下两个表并插入数据 CREAT ...
- 【转载】C#通过Remove方法移除DataTable中的某一列数据
在C#中的Datatable数据变量的操作过程中,有时候我们需要移除当前DataTable变量中的某一列的数据,此时我们就需要使用到DataTable变量内部的Columns属性变量的Remove方法 ...
- 微信小程序生命周期详解
文章出处:https://blog.csdn.net/qq_29712995/article/details/79784222 在我看来小程序的生命周期虽然简单,但是他渗透了小程序开发的整个过程,对于 ...
- SpringBoot2.x应用启动、关闭shell脚本
本篇主要说明以下内容: 1.SpringBoot2.x应用启动.关闭的shell脚本 1 启动脚本 直接放到同jar包同一个目录下,如下: #!/usr/bin/env bash APPLICATIO ...