Good day, I'm trying to configure visual studio code well to learn Opengl I use Glad and GLFW libraries this is the project that works in Xcode but I hate Xcode and I want to make it go to Visual studio Code.
Git:
https://github.com/nio74/LearnOpeng_VSC.git
Now I want to use My MyClassShader Class to read shaders but I get this error:
Executing task: clang++ -std=c++17 -stdlib=libc++ -lglfw -lglew --include-directory=include/ --include-directory=build/ --include=include/glad.c -framework OpenGL -framework IOKit -framework Cocoa src/main.cpp -o build/helloworld --debug <
Undefined symbols for architecture x86_64:
"MyClassShader::use()", referenced from:
_main in main-9146b5.o
"MyClassShader::MyClassShader(char const*, char const*)", referenced from:
_main in main-9146b5.o
"MyClassShader::setFloat(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float) const", referenced from:
_main in main-9146b5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The terminal process "/bin/bash '-c', 'clang++ -std=c++17 -stdlib=libc++ -lglfw -lglew --include-directory=include/ --include-directory=build/ --include=include/glad.c -framework OpenGL -framework IOKit -framework Cocoa src/main.cpp -o build/helloworld --debug'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
What I have tried:
This is the project that works in Xcode but I hate Xcode and I want to make it go to Visual studio Code.
this is tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "HelloWorld",
"type": "shell",
"command": "clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-lglfw",
"-lglew",
"--include-directory=include/",
"--include-directory=build/",
"--include=include/glad.c",
"-framework",
"OpenGL",
"-framework",
"IOKit",
"-framework",
"Cocoa",
"src/main.cpp",
"-o",
"build/helloworld",
"--debug"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
do You have any idea? I change compilator?