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. Ian Lance Taylor

    https://img.mukewang.com/5a9dfda50001933e23006728.png 在GCC的世界中,没有人比Ian更火.在GCC maillist中,Ian的身影呈现在前端中 ...

  2. dom xss->半自动化

    前几天看了两篇文章,觉得很不错,写一笔,就当笔记记录. 第一篇文章:https://jinone.github.io/bugbounty-dom-xss/ 作者写了自己通过自动化挖dom xss,差不 ...

  3. 英格索兰扳手网口通信协议EOR原理

    前言 前几天遇到这个需求,需要记录扳手每一次的周期数据,但是我不知道通信协议是什么,只知道是一个tcp的连接,问售后,也不给我网口调试软件(英格索兰自己家的软件).经过我俩天的谷歌,终于找到了他们公司 ...

  4. MathNet用到的一些功能

    1.计算一元线性函数 Tuple<double, double> myLineTuple = MathNet.Numerics.Fit.Line(myXArray, myYArray); ...

  5. C++编程笔记(GPU并行编程)

    目录 一.配置并使用 二.代码 三.内存管理 数组的分配 一.配置并使用 环境:Windows10 + CLion + VS2019 cuda的安装,并行的话只需要安装cuda,cuDNN就不必了 编 ...

  6. 多进程TCP服务端并发- 进程join方法 - IPC机制

    目录 同步与异步 阻塞与非阻塞 综合使用 创建进程的多种方式 进程间数据隔离 进程join方法 IPC机制 生产者消费者模型 进程对象的多种方法 僵尸进程与孤儿进程 守护进程 多线程实现TCP服务端并 ...

  7. 利用node快速生成脚本

    整理框架时突然发现两个文件从来没有使用过,删除的瞬间仿佛get到了用处. fs 可用于与文件系统进行交互模块 path 提供一些实用工具,用于处理文件和目录的路径 process.argv 返回一个数 ...

  8. 持续发烧,聊聊Dart语言的并发处理,能挑战Go不?

    前言 貌似关于Dart的文章没流量啊,就算在小编关怀上了首页,看得人还是很少的. 算了,今天持续发烧,再来写写如何使用 Dart 语言的并发操作.说起并发操作,玩 Go 的同学该笑了,这就是我们的看家 ...

  9. 【数据结构与算法】希尔排序 python和c++实现

    算法思路 每一次:固定间隔把数据分组,每一组进行排序 每次比上次选取更小的间隔分组,再每组排序,直到间隔为1 代码 c++:(越看越不明白了,后看) int gap = length;//length ...

  10. A_A01_001 KEIL4-KEIL5软件安装

    @ 目录 一.软件下载 二.交流学习 三.防止电脑误删文件操作步骤 四.KEIL4安装 五.KEIL5安装 六.注意事项 一.软件下载 KEIL4/KEIL5网盘链接 戳它跳转 提取码:omni 二. ...