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. vue 3.0 常用api 的简介

    vue3.0 生命周期 写法一 和vue2.x 一致 区别在于(beforeUnmount.unmount)名称不一样 写法二 在setup 中使用, 需要引用 如: import { onBefor ...

  2. Bugku login1

    打开是个普普通通的登录界面,盲猜是注入题,先看看源码吧,没找到什么有用的信息,那就先注册试试 注册admin就已经存在,可能待会就爆破admin的密码也可能,因为没有验证嘛 试试注册其他的 登录发现他 ...

  3. 【GUI开发案例】用python爬百度搜索结果,并开发成exe桌面软件!

    一.背景介绍 你好,我是 @马哥python说 ,一名10年程序猿. 1.1 老版本 之前我开发过一个百度搜索的python爬虫代码,具体如下: [python爬虫案例]用python爬取百度的搜索结 ...

  4. Fastjsonfan反序列化(一)

    前置知识 Fastjson 是一个 Java 库,可以将 Java 对象转换为 JSON 格式,当然它也可以将 JSON 字符串转换为 Java 对象. Fastjson 可以操作任何 Java 对象 ...

  5. 初次邂逅 EasyExcel

    前言 由于工作原因,有这种需求,就是把数据库中的数据导出成 Excel 表格,同时,也得支持人家用 Excel 表格导入数据到数据库.当前项目也是在用 EasyExcel,所以我不得不学啦! 以前学习 ...

  6. C++编程笔记(STL学习)

     一.顺序容器   1.1.vector   1.2.dequeue   1.3.list  二.关联性容器   2.3.set   2.3.map  三.算法   3.1.遍历算法(for_each ...

  7. angr_ctf——从0学习angr(二):状态操作和约束求解

    状态操作 angr中提到的状态(state)实际上是一个Simstate类,该类可由Project预设得到.预设完成后,还可以根据需要对某些部分进行细化操作. 一个state包含了程序运行到某个阶段时 ...

  8. 一步步带你设计MySQL索引数据结构

    前言 MySQL的索引是一个非常重要的知识点,也基本上是面试必考的一个技术点,所以非常重要.那你了解MySQL索引的数据结构是怎么样的吗?为什么要采用这样的数据结构? 现在化身为MySQL的架构师,一 ...

  9. 如何使用 System.Text.Json 序列化 DateTimeOffset 为 Unix 时间戳

    在 .NET 中,日期和时间通常使用 DateTime 或 DateTimeOffset 来表示.这两种数据类型都可以表示日期和时间,但它们之间有一些明显的区别.DateTime 是不带时区信息的,而 ...

  10. Blazor组件自做十二 : Blazor Pdf Reader PDF阅读器 组件 (新版 7.1 移除pdfobject)

    Blazor Pdf Reader PDF阅读器 组件 示例: https://www.blazor.zone/PdfReaders https://blazor.app1.es/pdfReaders ...