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语言

相关推荐
一方热衷.3 小时前
YOLO26-Seg ONNXruntime C++/python推理
开发语言·c++·python
仰泳的熊猫5 小时前
题目2194:蓝桥杯2018年第九届真题-递增三元组
数据结构·c++·算法
2301_803554525 小时前
linux 以及 c++编程里对于进程,线程的操作
linux·运维·c++
小糯米6017 小时前
C++ 排序
c++·算法·排序算法
EverestVIP7 小时前
c++前置声明的方式与说明
开发语言·c++
老约家的可汗8 小时前
C++篇之类和对象下
java·开发语言·c++
Mr_WangAndy8 小时前
C++数据结构与算法_排序算法
c++·排序算法·基础排序·高级排序
Irissgwe8 小时前
C&C++内存管理
c语言·开发语言·c++·c++内存管理
玖釉-9 小时前
解密图形渲染的性能原罪 —— Draw Call
c++·windows·图形渲染