I want to add library dependencies to my project without having to copy and paste them to MinGW folders. Is there some way to do this through VS Code instead? Pretty much something similar to how Visual Studio works with the include paths.
NOTE: my configuration compiles and works perfectly up until you try to add external dependencies.
c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceRoot}",
"/usr/include",
"/usr/local/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Linux",
"includePath": [
"${workspaceRoot}",
"/usr/include",
"/usr/local/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
"${workspaceRoot}/Dep/include/*",
"${workspaceRoot}/Dep/lib/glew32.lib"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
]
}
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "g++",
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"tasks": [
{
"taskName": "Build",
"suppressTaskName": true,
"windows": {
"args": [
"-g",
"--std=c++11",
"main.cpp",
"-o", "Builds/Win/engine",
"glew32.lib",
// LIB ARGS
"-lopengl32",
"-lglu32",
//"-lmingw32",
"-lglew32"
]
}
}
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"request": "launch",
"type": "cppvsdbg",
"program": "${workspaceRoot}/Builds/Win/engine.exe",
"preLaunchTask": "Build",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"windows": {
"program": "${workspaceRoot}/Builds/Win/engine.exe"
}
}
]
}
I don't think you can do this because the build related dependency is handled by Makefile or CMakeLists.txt
The "includePath" added in c_cpp_properties.json are used for lint or IntelliSense, nothing about the build.
You don't have to copy dependencies into MinGW folders. All you have to do is add you include directory and library to your build system, eg: Makefile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With