1.安装cygwin

2.配置VS Code

按ctrl + shift + p ,选择  c/c++:Edit configuration(json)
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${default}",
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerPath": "C:/cygwin64/bin/g++.exe",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}

launch.json

{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) 启动",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/usehello.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
//"console": "externalTerminal"
}
]
}

tasks.json

{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\cygwin64\\bin\\g++.exe",
"args": [
"-g",
"${workspaceFolder}/*.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\cygwin64\\bin,${fileDirname}",
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Generated task by Debugger"
}
],
"version": "2.0.0"
}

工程目录

main.c

CMakeLists.txt

src

{

hello.c

CMakeLists.txt

}

inc

{

hello.h

}

main.c

#include "hello_tast.h"

int main ( int argc, char** argv )
{
hello_fun();
return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
PROJECT( usehello )
INCLUDE_DIRECTORIES(include)
ADD_SUBDIRECTORY(src bin)
add_executable( usehello main.cpp )
target_link_libraries( usehello hello)

hello_task.cpp

#include "hello_tast.h"
#include <iostream>
using namespace std; void hello_fun ( void )
{
cout << " hello_test " << endl;
}

CMakeLists.txt

SET( LIBHELLO_SRC hello_tast.cpp )
ADD_LIBRARY( hello SHARED ${LIBHELLO_SRC} )
INCLUDE_DIRECTORIES(../include)

hello_task.h

#ifndef HELLO_H
#define HELLO_H #include <stdio.h>
void hello_fun( void );
#endif

VS Code windows系统C/C++环境配置_添加路径的更多相关文章

  1. Windows系统下pthread环境配置

    记录下win7系统,vc6.0++编译器下配置POSIX多线程环境的步骤. 配置 下载地址 ftp://sourceware.org/pub/pthreads-win32/ 我下载的版本是 fpthr ...

  2. Windows Server2008 R2 MVC 环境配置

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  3. CentOS(六)--Linux系统的网络环境配置

    Linux系统下的网络环境配置,Linux.Unix就是网络的世界,所以在Linux系统中如何配置网络环境变量是至关重要的,这里将会给出3种Linux系统下网络环境配置的方法! 在配置网络环境之前,首 ...

  4. Metabase在Windows下的开发环境配置

    Metabase在Windows下的开发环境配置 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} Metabase在Wind ...

  5. 第一篇 Windows 8 开发Windows Metro style app环境配置

    半   饱问 题 到 我 这 里 为 止! 第一篇 Windows 8 开发Windows Metro style app环境配置 2012-09-24 08:24 by 半饱, 1289 阅读, 3 ...

  6. 【Objective-C】Windows下Objective-C开发环境配置

    [Objective-C]Windows下Objective-C开发环境配置 ftp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/   最近打 ...

  7. windows下spark开发环境配置

    http://www.cnblogs.com/davidwang456/p/5032766.html windows下spark开发环境配置 --本篇随笔由同事葛同学提供. windows下spark ...

  8. windows下apache+https环境配置

    windows下apache+https环境配置 转 https://www.cnblogs.com/sandaizi/p/7519370.html 1.修改配置文件conf/httpd.conf,去 ...

  9. Windows系统下的adb 配置

    1.将附件中的adb_tools.rar文件下载到电脑上,并解压.(注意:其路径尽量避免带有中文字符) 2.右键点击“计算机”->“属性”->“高级系统设置”->“高级”->“ ...

  10. Windows下Go安装&环境配置&编译运行

    Go下载安装 官方Go下载站点:https://golang.google.cn/ 也可以选择:https://studygolang.com/dl 配置环境变量 常用环境变量 GOROOT GORO ...

随机推荐

  1. JUnit 5 单元测试教程

    点赞再看,动力无限. 微信搜「程序猿阿朗 」. 本文 Github.com/niumoo/JavaNotes 和 未读代码博客 已经收录,有很多知识点和系列文章. 在软件开发过程中,我们通常都需要测试 ...

  2. ubuntu 20.04 / 22.04 运行32位程序

    sudo dpkg --add-architecture i386 sudo apt install libc6:i386 libstdc++6:i386 sudo apt-get update su ...

  3. Java对象拷贝原理剖析及最佳实践

    作者:宁海翔 1 前言 对象拷贝,是我们在开发过程中,绕不开的过程,既存在于Po.Dto.Do.Vo各个表现层数据的转换,也存在于系统交互如序列化.反序列化. Java对象拷贝分为深拷贝和浅拷贝,目前 ...

  4. 关于linux更改root用户下面的鼠标样式

    前言 这几天一直研究关于 lightmd 显示管理器(也就是刚进入系统的用户登录界面)的主题配置问题,我发现鼠标样式和登录个人用户的鼠标样式不一样(之前我也发现了,懒得捣鼓)今天抽出时间研究了一下,这 ...

  5. os sys json模块

    Day19 os sys json 今日内容概要 os模块 sys模块 json模块 json模块实践 今日内容详细 一.os模块 os模块主要与代码运行所在的操作系统打交道 import os 1. ...

  6. 【Shell案例】【while循环、正则表达式、sed、awk、grep】5、打印空行的行号

    描述写一个 bash脚本以输出一个文本文件 nowcoder.txt中空行的行号,可能连续,从1开始 示例:假设 nowcoder.txt 内容如下:ab c d e f 你的脚本应当输出:35791 ...

  7. Qwt开发笔记(二):Qwt基础框架介绍、折线图介绍、折线图Demo以及代码详解

    前言   QWT开发笔记系列整理集合,这是目前使用最为广泛的Qt图表类(Qt的QWidget代码方向只有QtCharts,Qwt,QCustomPlot),使用多年,系统性的整理,本系列旨在系统解说并 ...

  8. C# 操作IIS加强版(添加,删除,启动,暂停网站,默认页,绑定信息)

    C# 操作IIS加强版(添加,删除,启动,暂停网站,默认页,绑定信息) 主要功能如下 在本机的IIS创建Web网站 删除网站包括应用程序池 删除应用程序池 添加默认文档 删除默认文档 添加虚拟目录 删 ...

  9. Jmeter 之跨线程传参

    其他线程使用某个线程中提取的值,比如场景:客户端一直与服务端保持连接的同时进行其他业务操作 1.建立以下两个线程组,并添加相应业务接口 2.发送心跳时,需要token,在用户登录接口下添加提取器提取t ...

  10. MAUI新生4.6-主题设置LightTheme&DarkTheme

    通过主题设置,可以在运行时更改应用的主题外观,比如切换亮色主题和暗黑主题.主题设置并没有新的知识点,基本的原理如下: 定义每个应用主题的ResourceDictionary,每个ResourceDic ...