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. KubeEdge快速上手与社区贡献实践

    1.KubeEdge的架构特点与优势 持久化 云端组件,EdgeController,设备抽象API,CSI Driver,Admission WebHook 边缘组件,EdgeHub,MetaMan ...

  2. 【OpenStack云平台】网络控制节点 HA 集群配置

    个人名片: 因为云计算成为了监控工程师‍ 个人博客:念舒_C.ying CSDN主页️:念舒_C.ying 网络控制节点运行在管理网络和数据网络中,如果虚拟机实例要连接到互联网,网络控制节点也需要具备 ...

  3. 银河麒麟V10 SP1服务器操作系统-单用户模式与救援模式调试方法

    单用户模式 单用户模式:该模式下系统并没有完全运行进来,只是部分程序运行,包括网络服务,ssh服务等部分服务未运行,因此无法通过远程登录到操作系        统.进入单用户方式进行系统维护由是ROO ...

  4. C温故补缺(十一):文件读写

    文件读写 打开文件 fopen( ) 函数来创建一个新的文件或者打开一个已有的文件 FILE *fopen( const char *filename, const char *mode ); fil ...

  5. ArrayList中的ConcurrentModificationException,并发修改异常,fail-fast机制。

    一:什么时候出现? 当我们用迭代器循环list的时候,在其中用list的方法新增/删除元素,就会出现这个错误. package com.sinitek.aml; import java.util.Ar ...

  6. VulnHub靶场渗透实战8-DarkHole: 2

    靶场地址:DarkHole: 2 ~ VulnHub DescriptionBack to the Top Difficulty:Hard This works better with VMware ...

  7. Redis Lettuce长时间超时问题

    1. 背景 新上线了一个服务,在压测的时候大量返回错误,查看报错是io.lettuce.core.RedisCommandTimeoutException: Command timed out aft ...

  8. 接口Interface的作用不止是解耦

    简言: 好久没写博客了,今天手痒想写一写.废话少说,我们直入主题,相信大家对接口interface,这个单词一定不陌生.但是要说到它的作用,除了解耦之外,还有什么作用呢?可能大多数人都不是很清楚(大牛 ...

  9. <五>基于CAS操作的atomic原子类型

    C++11多线程类库中提供了 include包含了很多原子类型 原子操作 若干汇编指令具有读-修改-写类型,也就是说它们访问存储器单元两次,第一次读原值,第二次写新值 假定运行在两个cpu上的两个内核 ...

  10. 实现 .Net 7 下的数据库定时检查

    在软件开发过程中,有时候我们需要定时地检查数据库中的数据,并在发现新增数据时触发一个动作.为了实现这个需求,我们在 .Net 7 下进行一次简单的演示. PeriodicTimer .Net 6 中新 ...