一、情况1:所有源码都在同一文件夹下设置
文件的组织如图1所示:
图1
1、printHello.h
#ifndef PRINTHELLO_H_
#define PRINTHELLO_H_
void printHello();
#endif
2、printHello.cpp
#include ”printHello.h”
#include <stdio.h>
void printHello()
{
printf(”Hello.\n”);
}
3、tasks.json 文件
{
”tasks”: [
{
”type”: ”cppbuild”,
”label”: ”C/C++: gcc.exe build active file”,
”command”: ”C:\\Program Files\\CodeBlocks\\MinGW\\bin\\gcc.exe”,
”args”: [
”-fdiagnosticscolor=always”,
”-g”,
//”${file}”,
”${fileDirname}\\*.cpp”,