使用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 ...
随机推荐
- C#项目 App.config 配置文件不同使用环境配置
问题 部署项目时,常常需要根据不同的环境使用不同的配置文件.例如,在部署网站时可能希望禁用调试选项,并更改连接字符串以使其指向不同的数据库.在创建 Web 项目时,Visual Studio 自动生成 ...
- Spring Security OAuth2.0 - AuthorizationServer和ResourceServer分离
<Spring Security实现OAuth2.0授权服务 - 基础版>和<Spring Security实现OAuth2.0授权服务 - 进阶版>两篇文章中介绍如何搭建OA ...
- docker mac 命令行登录报错处理 : Error saving credentials: error storing credentials - err: exit status 1
参考:https://blog.csdn.net/xufwind/article/details/88756557 比较新版本的docker命令行登录会出现以下错误: Error saving cre ...
- Map作为缓存使用
public class MapCache { /** * 默认存储1024个缓存 */ private static final int DEFAULT_CACHES = 1024; private ...
- Java自学-接口与继承 Object类
Java中的超类 Object 步骤 1 : Object类是所有类的父类 声明一个类的时候,默认是继承了Object public class Hero extends Object package ...
- 86.使用webpack爬过的坑
Webpack 4 和单页应用入门 https://github.com/wallstreetcn/webpack-and-spa-guide
- 汽车制造商表态:必须依靠MES系统来管控流程
汽车行业特点 汽车工业是一个高投入,高产出,集群式发展的产业部门. 汽车自身的投资,生产,研发,供应,销售,维修:前序的原材料,零部件,技术装备,物流:后序的油料,服务,信贷,咨询,保险,直至基础设施 ...
- Go语言入门——函数
写了快一个月的Go,已经没有什么陌生感了. 一行代码写完,不会在行尾本能的敲上“:”,直接Enter键换行: 定义变量把变量名放在前面,类型放在后面: 使用struct去定义自己想要的数据模型就好比定 ...
- redis-5.0.5安装(linux centos)
下载 cd /data wget http://download.redis.io/releases/redis-5.0.5.tar.gz 历史版本库地址 http://download.redis. ...
- ubuntu17升级到18.04
问题描述: ubuntu不是LTS长期支持的版本在支持期过了,没有apt源提供支持.所以需要升级到对应的LTS版本 问题解决: 实验环境: ubuntu17.10--->ubuntu18.04. ...