C++学习笔记(一):安装VisualStudio和Vcpkg

VisualStudio安装



error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

cpp 复制代码
#include <stdio.h>

int main() {
	printf("hello");
	int a = 0;
	scanf("%d", &a);
	printf("%d\n", a);
	return 0;
}

解决方案:

cpp 复制代码
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
	printf("hello");
	int a = 0;
	scanf("%d", &a);
	printf("%d\n", a);
	return 0;
}

vcpkg安装

vcpkg有自动集成到Visual Studio的命令。

示例下载plibsys:

参考

C++ - 安装和使用vcpkg

以curl库为例演示vcpkg的安装和基本操作

VS2022安装使用教程,Visual Studio 2022详细安装使用调试教程C语言

相关推荐
AI+程序员在路上6 分钟前
Qt6中模态与非模态对话框区别
开发语言·c++·qt
岁忧5 小时前
(LeetCode 面试经典 150 题 ) 11. 盛最多水的容器 (贪心+双指针)
java·c++·算法·leetcode·面试·go
蜉蝣之翼❉10 小时前
CRT 不同会导致 fopen 地址不同
c++·mfc
aramae10 小时前
C++ -- STL -- vector
开发语言·c++·笔记·后端·visual studio
lixzest11 小时前
C++ Lambda 表达式详解
服务器·开发语言·c++·算法
_Chipen11 小时前
C++基础问题
开发语言·c++
灿烂阳光g12 小时前
OpenGL 2. 着色器
c++·opengl
AA陈超13 小时前
虚幻引擎UE5专用服务器游戏开发-20 添加基础能力类与连招能力
c++·游戏·ue5·游戏引擎·虚幻
mit6.82413 小时前
[Meetily后端框架] AI摘要结构化 | `SummaryResponse`模型 | Pydantic库 | vs marshmallow库
c++·人工智能·后端
R-G-B13 小时前
【02】MFC入门到精通——MFC 手动添加创建新的对话框模板
c++·mfc·mfc 手动添加创建新的对话框