admin管理员组文章数量:1387461
Have library glfw3 that needs importing into imgui demo project. I know how to configure the library paths in the .vscode/c_cpp_properties.json file and the intellisense feature brings me right to the library if I search the definition just when it compiles it throws the error.fatal error: GLFW/glfw3.h: No such file or directory.
I have already spent hours trying every solution I could find and nothing has worked / gotten me past this error.
(This is a Linux system, using g++ (11.4.0) compiler but have tried others too.)
.vscode/c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/brandon/Coding/cpp_install/"
],
"defines": [],
"compilerPath": "/usr/bin/g++-11",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
.vscode/tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "Build Debug",
"command": "g++",
"args": [
"${workspaceRoot}\\main.cpp",
"-I /home/brandon/Coding/cpp_install/GLFW",
"-L /home/brandon/Coding/cpp_install/",
"-lglfw",
"-g",
"-o",
"${workspaceRoot}\\main"
],
}
],
"version": "2.0.0"
}
EDIT: I use the vscode code runner to do the automatic compile.
INFORMATION:
glfw file path: /home/brandon/Coding/cpp_install/GLFW/
I do believe that the build process is not using tasks.json and I am not really sure how to properly compile without the code runner.
What is the best route to compile outside of vscode (or easily inside) with still using vscode as my main editor.
Have library glfw3 that needs importing into imgui demo project. I know how to configure the library paths in the .vscode/c_cpp_properties.json file and the intellisense feature brings me right to the library if I search the definition just when it compiles it throws the error.fatal error: GLFW/glfw3.h: No such file or directory.
I have already spent hours trying every solution I could find and nothing has worked / gotten me past this error.
(This is a Linux system, using g++ (11.4.0) compiler but have tried others too.)
.vscode/c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/brandon/Coding/cpp_install/"
],
"defines": [],
"compilerPath": "/usr/bin/g++-11",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
.vscode/tasks.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "Build Debug",
"command": "g++",
"args": [
"${workspaceRoot}\\main.cpp",
"-I /home/brandon/Coding/cpp_install/GLFW",
"-L /home/brandon/Coding/cpp_install/",
"-lglfw",
"-g",
"-o",
"${workspaceRoot}\\main"
],
}
],
"version": "2.0.0"
}
EDIT: I use the vscode code runner to do the automatic compile.
INFORMATION:
glfw file path: /home/brandon/Coding/cpp_install/GLFW/
I do believe that the build process is not using tasks.json and I am not really sure how to properly compile without the code runner.
What is the best route to compile outside of vscode (or easily inside) with still using vscode as my main editor.
Share Improve this question edited Mar 17 at 18:13 A-Person-Who-Codes asked Mar 17 at 6:50 A-Person-Who-CodesA-Person-Who-Codes 95 bronze badges 10- Use a proper build system and fet the rubbish C/C++ code runner. – Botje Commented Mar 17 at 8:42
- What would be the best route to make a build system and getting away from the vscode code runner? – A-Person-Who-Codes Commented Mar 17 at 13:55
- to have a comment adressed to specific user, you must prepend a comment with '@username'. this way, user gets notified about your comment. – iam_ai_copy-paste Commented Mar 17 at 14:14
- i use 'makefile's as a build system. i use 'make' with 'vscode'. i find it quickier to configure and faster to use. the vscode json mantra is another thing to learn and occupy a place in my head. – iam_ai_copy-paste Commented Mar 17 at 14:18
- @Botje What would the best system to do this, makefile? – A-Person-Who-Codes Commented Mar 17 at 17:34
1 Answer
Reset to default 0In tasks.json change
"-I /home/brandon/Coding/cpp_install/GLFW"
to
"-I /home/brandon/Coding/cpp_install"
As you said yourself you have the correct include path in c_cpp_properties.json so I'm not sure why you didn't put the same path in tasks.json.
BTW the -L
option in tasks.json also looks wrong, but that's a different issue.
本文标签: visual studio codeConfusion on configuring c library paths in vscodeg compilerStack Overflow
版权声明:本文标题:visual studio code - Confusion on configuring c++ library paths in vscodeg++ compiler - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744576312a2613645.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论