6

How can I configure the tasks.json file so that when I press Ctrl + Shift + B the copier will use pkg-config gtkmm-3.0 --cflags --libs.

My file looks like this:

"version": "0.1.0",
"command": "g++ `pkg-config gtkmm-3.0 --cflags --libs`",
"isShellCommand": true,
"args": ["main.cpp"]

But it returns this message: Failed to launch external program g++ pkg-config gtkmm-3.0 --cflags --libs main.cpp. spawn g++ pkg-config gtkmm-3.0 --cflags --libs ENOENT

If I put it as an argument, like this:

"version": "0.1.0",
"command": "g++",
"isShellCommand": true,
"args": ["main.cpp", "pkg-config gtkmm-3.0 --cflags --libs`"]

Returns this message:

g++: error: pkg-config gtkmm-3.0 --cflags --libs`: 
File or directory not found
Theo
  • 57,719
  • 8
  • 24
  • 41
Matheus Toniolli
  • 438
  • 1
  • 7
  • 16
  • you forgot the ` before pkg-config on the second alternative (as an argument). Another option would be to create a Makefile and have VS Code invoke make. I don't use VS Code that often so i may be wrong. – José Fonte Jun 15 '17 at 22:12
  • For the time being I created a Makefile file as you suggested. – Matheus Toniolli Jun 16 '17 at 00:32

1 Answers1

18

you can try this!

"version": "0.1.0"
"command": "g++",
"isShellCommand": true,
"args": [
         "main.cpp",
         "`pkg-config", "--libs", "--cflags", "gtkmm-3.0`",
 ]

you should control how the argument is quoted.
more information: Task in Visual Studio Code

sla
  • 196
  • 2
  • 6