Nvm all, my friend helped me solve it. It was complications with my tasks.json file, not launch.json.
Here’s my code for the poor soul trying to solve this in the future:
main.cpp
#include <iostream>
#include "utils/greet.hpp"
using namespace std;
int main(){
greet("Alan");
return 0;
}
greet.cpp under my “utils” subfolder:
#include <iostream>
using namespace std;
void greet(string name){
cout << "Hello " << name;
}
greet.hpp under “utils” subfolder:
#ifndef UTILS_GREET
#define UTILS_GREET
#include <string>
void greet(std::string name);
#endif
tasks.json in “args”: [ ]
"args": [
"-fdiagnostics-color=always",
"-g",
"-std=c++20",
"${workspaceFolder}\\*.cpp",
"${workspaceFolder}\\utils\\*.cpp",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe"
],
and launch.json wasn’t needed, but in case anyone would still like to see:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}