使用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 ...
随机推荐
- SQL Server的外键必须引用的是主键或者唯一键(转载)
问: In SQL Server , I got this error -> "There are no primary or candidate keys in the refere ...
- .net Dapper 实践系列(6) ---事务删除(Layui+Ajax+Dapper+MySQL)
目录 写在前面 实现步骤 写在最后 写在前面 上一小节,总结了事务多表更新的两种方法.一个是只更新原来的数据,一个是先删除原来的数据再往里面添加新的数据.而这一小节,说的是事务的多表删除. 实现步骤 ...
- C#读写修改设置调整UVC摄像头画面-伽玛
有时,我们需要在C#代码中对摄像头的伽玛进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄像 ...
- systemd - CentOS 7进程守护&监控
需求: 运行环境为CentOS 7系统,我们开发了一个程序,需要在开机时启动它,当程序进程crash或者开机之后,守护进程立即拉起进程. 解决方案: 使用CentOS 7中的init进程systemd ...
- React Context API
使用React 开发程序的时候,组件中的数据共享是通过数据提升,变成父组件中的属性,然后再把属性向下传递给子组件来实现的.但当程序越来越复杂,需要共享的数据也越来越多,最后可能就把共享数据直接提升到最 ...
- Java 流程控制 之 分支结构——条件判断语句
一.判断语句 1.判断语句1-- 单 if 语句(单分支结构) 语法格式: if(条件表达式){ 语句体; } 执行流程: 首先判断条件表达式看其结果是 true 还是 false: 如果是 tru ...
- Maven打包的三种方式
Maven可以使用mvn package指令对项目进行打包,如果使用Java -jar xxx.jar执行运行jar文件,会出现"no main manifest attribute, in ...
- MySQL 如何优化大分页查询?
一 背景 大部分开发和DBA同行都对分页查询非常非常了解,看帖子翻页需要分页查询,搜索商品也需要分页查询.那么问题来了,遇到上千万或者上亿的数据量怎么快速的拉取全量,比如大商家拉取每月千万级别的订单数 ...
- Maven国内源设置 - OSChina国内源失效了,别更新了
Maven国内源设置 - OSChina国内源失效了,别更新了 原文:http://blog.csdn.net/chwshuang/article/details/52198932 最近在写一个Spr ...
- linux服务器问题排查:w命令卡住
基本情况 系统: ubuntu16.04 症状: who命令可以用,w命令用不了 sudo iotop命令会卡住,黑屏 nvidia-smi命令和nvl命令都用不了,卡住 排查步骤 strace ps ...