g++ / vscode apparently cannot see my src folder? "cc1plus.exe: fatal error: src/glad.c No such file or directory"

35 Views Asked by At

(Before someone mentions similar questions with the same issue, yes I have checked my path for spaces and whatnot. Heres my path to the project root: C:\Users\sircode\Documents\GitHub\Univox\ So Im not sure what else could be causing it)

Title says the gist of it. Im trying to get a purely VSCode c++ / opengl project running, but Ive been struggling to get g++ to see the files via my tasks.json file.

My args in the tasks file are as such:

"args": [
    "-g",
    "-std=c++17",
    "-I./include",
    "-L./lib",
    "src/\\*.cpp",
    "src/glad.c",
    "-lglfw3dll",
    "-o",
    "${workspaceFolder}/prog.exe"
],

When I try to click the Run C/C++ File task, it fails to run and fires these errors into the console:

Starting build...
cmd /c chcp 65001>nul && C:\msys64\ucrt64\bin\g++.exe -g -std=c++17 -I./include -L./lib src/\*.cpp src/glad.c -lglfw3dll -o C:\Users\sircode\Documents\GitHub\Univox/prog.exe
cc1plus.exe: fatal error: src/\*.cpp: No such file or directory
compilation terminated.
cc1plus.exe: fatal error: src/glad.c: No such file or directory
compilation terminated.

Build finished with error(s).

My folder structure should work with that command but it just doesnt, and I have absolutely no clue why. Ive attempted appending a parent / project root reference (../ and ./) to the folder paths with no luck.

I dont know if Im just missing something really obvious here, but Im out of ideas.

Heres my project structure:

enter image description here

1

There are 1 best solutions below

3
Mister SirCode On

Thanks to the simple quick answer by Drescherjm.

I was simply missing "${workspaceFolder}" from all the references. Not sure why the original guide was missing that.

The include and lib folder were also broken after fixing the initial src folder, but the same solution applies to them.

Working args adjusted for the include, lib, and src folders:

"args": [
    "-g",
    "-std=c++17",
    "-I${workspaceFolder}/include",
    "-L${workspaceFolder}/lib",
    "${workspaceFolder}/src/*.cpp",
    "${workspaceFolder}/src/glad.c",
    "-lglfw3dll",
    "-o",
    "${workspaceFolder}/prog.exe"
],