1、安装VS Code,现在好像默认带了C/C++插件。
2、创建项目:可以在 文件->打开文件夹 中创建项目文件夹;
3、编写程序:
-test
--main.c
--source.c
--source.h
--.vscode
----launch.json
----tasks.json
.vscode文件夹后续由VS Code自动创建;
main.c
#include <stdio.h>
#include "source.h"
int main(void)
{
printf("add:%d\n", add(2, 5));
printf("sub:%d\n", sub(5, 2));
return 0;
}
source.h
extern int add(int a, int b);
extern int sub(int a, int b);
source.c